19 CEO Dashboard Examples for Business Leaders
Let's rewind to the 1990s. Data used to be stored on servers and CEOs relied on basic tools to make optimal decisions. No dashboards, nothing. When you use Power BI with a solid...
Kapil Panchal - September 14, 2020
Listening is fun too.
Straighten your back and cherish with coffee - PLAY !
C# is an object-oriented, general-purpose, modern programming language. It is pronounced as “C sharp” and it is the most widely used language by .Net development companies to develop both small-scale and large-scale projects. International Standards Organization (ISO) and the European Computer Manufacturers Association (ECMA) approved C# under the .Net initiative. By using C# language, you can also develop cross-platform applications. C# 8.0 is supported on.NET Standard 2.1 and .NET Core 3.x.
It helps to prevent the ubiquitous null reference exceptions. In the Null reference type, pulling null into ordinary reference types such as string that makes those types non-nullable. It comes so gently, with a warning, not errors.
In case if you don’t want to use the nullable reference type then you can use a string and if you try to use a nullable reference then first need to check for null. First compiler analyses the flow of your code to see if it’s the null value. Developers can opt for null checking if they are ready to deal with result warnings.
C# Version 8.0 has improvements of pattern matching functionality which has already been added to the C# 7.0 version.
There are many new forms of pattern matching that are being added to the C# 8.0 version. Pattern matching like Tuple pattern which allows matching of more than one value in a single pattern-matching expression like a switch. When the only result of pattern matching is assigning a value to a single variable, Switch expression allows terser syntax than switch statements. Property pattern, if a type doesn’t have an appropriate Deconstruct method, then you can use property pattern to achieve the same as with positional patterns.
C# already has support for asynchronous and iterator methods. In C# 8.0 version, the two IEnumerable and IEnumerator interface are combined into asynchronous streams. Also, an asynchronous version of the IDisposable interface is required for the asynchronous iterators. For example:
public static async System.Collections.Generic.IAsyncEnumerableCreateList() { for (int i = 0; i <35; i++) { await Task.Delay(100); yield return i; } }
C# 8.0 presents a new syntax for expressing a range of values. The starting range of the index is inclusive and the ending index is exclusive.
Using declaration statement can ensure that the Dispose method will be called on type implementing the IDisposable interface once the instance gets out of scope. It is readable and less error-prone than the equivalent code written with the statement. For example:
This function was introduced in C # 7.0 version. It automatically catches the context of enclosing scope that viable to make any variables from the containing method available inside them.
But in C# 8.0 version you can declare a local function as static. If you declare the local function as static then it will prevent using variables from then containing method in the local function and at the same time, you can have the option to avoid the performance cost related to making them available.
In C # 8.0 versions you can implement the disposable pattern by simply defining the dispose method in the struct which was declared with ref modifier.
static int FileWriting(IEnumerablelines) { using var file = new System.IO.StreamWriter("FileWriteExample.txt"); int skippedLines = 0; foreach (string line in lines) { if (!line.Contains("Fifth")) { file.WriteLine(line); } else { skippedLines++; } } return skippedLines; }
This feature is introduced in C# 8.0. You can use a readonly modifier to members of the struct.
Readonly marks the member as not allowed to modify.
C# 8.0 has introduced the null-coalescing assignment operator which is ‘??=’
This operator is utilized to allocate the value of the right-hand operand to its left-hand operand while the left-hand operand’s value is null.
int? num = null; var numbers =new List(); numbers.Add(num??= 10); numbers.Add(num ??= 100); print(num); //output 10
In C#, you can create an interface with the declaration of members but not the implementation. But C# 8.0 has introduced a new feature that allows the interface to have declaration as well as the implementation of the members and while doing so, you are not breaking any previously existing implementation of the interface. That means, it is not necessary to implement members of the interface in class which inherits the interface.
This feature is similar to a technique that is used in Traits programming. The Trait is the OOP technique that encourages the reuse of methods between unrelated classes.
This feature is also termed as Virtual Extension methods. You can try this feature like below:
public interface IInterfaceDefault { public void DefaultMethod() { Console.WriteLine("Default Method!!"); } } public class ImplementedClass : IInterfaceDefault { } class Program { static void Main() { IInterfaceDefault ImplementedClass = new ImplementedClass (); ImplementedClass.DefaultMethod(); } } //Output: Default Method!!
In the existing Switch statement, case and break statements are redundant as they are being repeated in each line of the switch statement.
In C# 8.0, we can assign the result of the switch statement to the variable or can directly return the result. This way, there is no redundant break and case.
As we have seen in the Pattern Matching feature of C# 8.0, you can also pass multiple parameters to the switch statement.
Below example illustrates the use of the new Switch expression:
class Program { static void Main(string[] args) { var operationType=1; float ans=operationType switch { 1=>5+3, 2=>5-3. 3=>5*3. 4=>5/3, 5=>5%3, }; Console.WriteLine(ans); } } //Output 8
As the name suggests, stackalloc allocates a block of memory in the stack. When the function is completed, the memory block is deleted automatically.
C# 8.0 has allowed the use of stackalloc in nested expression if the result of an expression is either System.Span or System.ReadOnlySpan.
In previous versions of C#, orders of the tokens $ and @ in verbatim strings are fixed which is $ token must precede @ token.
But in C# 8.0, there is no specific order for these tokens. That means ‘$@’ and ‘@$’ both are valid sequences.
C# 8.0 has introduced a new interface IAsyncDisposable. By implementing this interface, you can perform asynchronous cleanup operations.
public async ValueTask DisposeAsync() { await Task.Delay(5000); }
After a long period of expectancy, the C# 8.0 version available in preview as part of Visual Studio 2019. Not all the features of C# 8.0 available in the .NET framework. The most important feature of the latest version C# 8.0 is null reference types, improvements to pattern matching, Asynchronous streams & Range and indices.
Build Your Agile Team
Let's rewind to the 1990s. Data used to be stored on servers and CEOs relied on basic tools to make optimal decisions. No dashboards, nothing. When you use Power BI with a solid...
Imagine walking into a meeting where critical decisions need to be made—fast. You need clear, flexible data that you can analyze on the spot. But what if your insights are locked inside...
Clear insights mean smarter decisions, and this is what data storytelling does. It helps you speak a language that you quickly understand. Like for example, you are a CTO dealing with...