C# 6.0… The one where we get what we want…

There are a lot of changes under the hood with the new release of Visual Studio 2015, ASP.NET and C# 6, but there are a couple syntactical changes that will not only make our code look better, but be a TON more efficient… Examples?

How about the ability to add conditional statements to catch blocks? i.e.

catch(System.Exception e) if (e.Message == "foo")
{
...
}

Nice, right?

How many times have you written a property get/set block, and then had to add constructor code which initializes the property? No more. Now:

public MyObject myObject { get; set; } = new MyObject();

Sweet!

There are a ton of other changes, here is a list of some favorites over at Telerik.

Leave a Reply

Your email address will not be published. Required fields are marked *