C# 6 features – Static using 2

One more C# 6 syntactic sugar feature is static using.  The feature eliminate explicit reference to the type when invoking a static method.

C# 6 features – Exception filters

Exception filters were already available in Visual Basic and F#, but not in C#. Recent release of C# 6 makes it equal. Below is example of exception filters syntax in C# 6. try { // do something dangerous } catch (Exception e) when (MyFilter(e)) { // action } If the expression after when  evaluates to true, the catch block is run, otherwise the exception keeps going. Next example: try { // … throw new ArgumentNullException(paramName: “someParam”); } catch (ArgumentNullException e) when (e.ParamName == “differentParam”) { // Appropriate action } In the above, the exception type matches and condition that follows […]

C# 6 features – String interpolation 1

This article is part of series about C# 6 features. Let focus on string interpolation this time. It’s one of the new C# features that will for sure affect the way you write C# code.

C# 6 features – nameof 1

Recent release of C# 6 and Visual Studio 2015 introduced many useful features. I’ll try do describe all of them. The first for today is support for nameof expressions.