Code Mahek
  • Blog
  • About
  • Contact
  • Random Clicks
  • Resume
  • Ava Chat Bot

Fragrance
​of Programming

.NET Core 3 Preview 2: Using Declarations & Switch Expressions

2/2/2019

Comments

 
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
comments powered by Disqus

    RSS Feed

    Categories

    All
    Azure
    C#
    Cloud
    CodeProject
    CSharp
    DotNet Core
    Jetbrains
    .NET
    Rider
    Source Generators
    SQL
    Tech News
    Ubuntu
    Visual Studio 2015
    Visual Studio 2019
    Windows
    Windows 10

    Archives

    May 2020
    February 2019
    January 2019
    December 2018
    May 2018
    December 2017
    November 2017
    October 2017
    September 2017
    July 2017
    May 2017
    April 2017
    May 2015
    April 2015
    March 2015

    View my profile on LinkedIn

Location

Contact Us

    Subscribe Today!

Submit
  • Blog
  • About
  • Contact
  • Random Clicks
  • Resume
  • Ava Chat Bot