Currently available C# versions are from C#1.0 to C # 6.0. In this blog will illustrate the different C# versions and there highlighted features with one liner description.
C# 1.0 (2002)
Managed Code: Code written in those more than 20 high level languages that runs on .NET framework and compiled into IL code. Example of other languages C#, J#, VB, JScript, C++ etc..
Managed Code execute in Manged environment ensure type safety, Garbage Collection.
C# 2.0 (2005)
Generics: Type parameter. Defer the type until the class/methods is instantiated.Can have a single class without incurring the cost or risk of casting or boxing operations. Use of generics is to create collection classes.
Partial Types: Split a Class/Structure/ interface into two or more source files. After compilation all parts combined into one.
Static Classes: Cannot instantiate. No new keyword can be used. Access member using Call class name itself.
Co- and Contra-variance: Enable implicit reference conversion of array type, delegate types and generic types arguments. Co-Variance enables to assign more derived type array into a less derived type. Ex. object array = new String; But Not type safe. more detailed on next separate blog.
Nullable Type: Value type variable.That can assign the value of null. Instance of System.Nullable struct. T? where T is value type like int…
C# 3.0 (2007)
Partial Method: Enable one place method definition and other place whether use this method or not. Features: always return void. No ref parameter. Implicit private so cannot be virtual.
Anonymous Types: Enable us to create object without writing class definition for the datatypes, instead compiler generate class for us.
Lambda Expression: An anonymous function use to create delegates or expression tree type. Can write a local function that can be passed as argument or returned as the value of function call. Helpful for writing LINQ query Expression. Lambda Operator =>
C# 4.0 (2010)
Dynamic Binding: Bypass compile time type checking. DLR(Dynamic Language Runtime). System.Dynamic namespace. typeof(dynamic)operator will give compile error.
Parallel Programming: Parallelism divide a certain task into related task to be executed concurrently. Task, Parallel classes.
Optional and Named Arguments: Optional parameter user can decide whether to provide a value or not. Must come after required parameter and should be constant value. Named parameter if have more than one optional parameter with same datatype. Ex.Work(int a=5, int b=7, int c); Work(b : 17);
C# 5.0 (2012)
C# 6.0 (2015)
Compiler as a service(Roslyn)
Using Static in Using Block.
Awaits in Catch/ Finally Block.