Fragrance
|
Microsoft recently released .NET Core 3 Preview 2 and includes more features for both .Net Core 3.0 and C# 8. .NET Core 3 will be supported in Visual Studio 2019, Visual Studio for Mac and Visual Studio Code. Visual Studio 2019 Preview 2 was released last week and has support for C# 8.
Now lets see some of the latest feature in C# 8.0: Using Declarations: With latest C# 8.0, you can now attache the using declaration to the scope of the current block of code and later you can dispose the object at the end. Below is the example.
Switch Expression:
One of the features which I really liked in C# 8 is the Switch Expression. Let's take the example and you will be able to understand properly.
In the above example you can see that first you don't need to declare the variable or explicit type each of the cases. Switch expressions enables terser syntax, returns a value since it is an expression, and fully integrated with pattern matching.
Code Source: Microsoft
Comments
|
Categories
All
Archives
May 2020
|