less than 1 minute read

The next release of C# 6 has some amazing new features. In a series of blog posts I will cover some of them.

A small but still significant feature in C# 6 is index initializers. Index initializers can be sued to initialize object members, but also dictionaries. Initializing a dictionary has always be cumbersome, but not anymore.

var numbers = new Dictionary<int, string>
  [7] = "seven",
  [9] = "nine",
  [13] = "thirteen"

There are other great new features in C# that I have not touched – have a look at the blog post New features in C# 6 by Mads Torgersen, Principal Program Manager, VS Managed Languages.

Tags: ,