August 30, 2015

C# 6: what's new

C# 6 was officially released about month ago, but it was in "preview" mode since the last year. So I am sure that everyone who wanted, can touch it and see all the new features. If not -  here's the list of updates in the latest version of C#.

Along with C# Microsoft released VB 14. They are both part of the Roslyn compiler, who is available on github.

String Interpolation
C#6
var str = $"Hello, {name}. You clicked {clickCount} time{{s}}";
It's good alternative to String.Format function. The same piece of code on C# 5 will looks like this
C#5
var str = String.Format("Hello, {0}. You clicked {1} time{s}", name, clickCount);