C# 6.0 New Features: Index Initializers
Another new feature although I would say syntax is Index Initializer. This features was although introduced in C# 3.0 and C# 6.0 provides just more concise syntax over that.
C# 6.0 introduces the concept of auto property initializer as we discussed in another blog post here
Also another feature is deferring the initialization of read-only property from constructor. This feature is available in most recent version of CTP
Since its release, C# has travelled a long journey from being a imperative language to a declarative one. With this journey the way we use to write methods have also changed a lot. Lets try to understand the journey of a method from C# 1.0 to 6.0
This is how we use to write methods in C# 1.0 .These were called named methods.Also you can see how a delegate is using a named method to print a value to console.
The most common programming practice is to catch exceptions and log them. Logging involves IO since we usually log into files or database. IO operations are usually expensive in terms of performance which means that in a serviced kind of environment, the end user who is waiting for a response is actually being kept waiting for logging messages as well.
Static in C#:
Static is a compiler reserved keyword in C#, which can be applied to any member of a class i.e. well Fields, methods, classes, Properties, Events or to a class itself as well.
There will be only one copy of a member variable declared as static. Each object has its own copy of instance variables whereas static variables are shared across objects.