You can get the unqualified string name of a type or member for use in an error message without hard coding a string. This allows your code to remain correct when refactoring. This feature is also useful for hooking up model-view-controller MVC links and firing property changed events.
You can use string interpolation expressions to construct strings. An interpolated string expression looks like a template string that contains expressions. C# creates a string by replacing the expressions with the ToString represenations of the expressions’ results. An interpolated string is easier to understand with respect to arguments than .
You can test for null in a very light syntactic way before performing a member access (?.) or index (?[]) operation. These operators help you write less code to handle null checks, especially for descending into data structures. If the left operand or object reference is null, the operations returns null.
You can now initialize specific elements of a collection that supports indexing, such as initializing a dictionary.
You can use initializers for collections now when the collection has an Add Extension method. Previously the Add method had to be an instance method.
Overload Resolution
The compiler has improved overload resolution that results in more code just working the way you would expect it to behave. One place where you might stop noticing a problem is when choosing between overloads taking nullable value types, or when passing method groups (instead of lambdas) to overloads that take delegates.
You can use exception filers in catch clauses to determine whether a catch clause should handle the exception. Without this feature, you have to rethrow the exception, which clips the call stack reported in the rethrown exception.
You can use await in catch and finally clauses.
You can initialize auto-properties now similarly to how you initialize fields.
You can define read-only auto-properties now without having to define a property with complete property syntax. You can initialize the property where you declare it or in the type’s constructor.
Function Members with Expression Bodies
You can declare members with expression-bodies of code in the same lightweight syntax you use with lambda expressions. See , , , and .
You can import accessible static members of static types so that you can refer to the members without qualifying the access with the type’s name.