All the feature with examples
https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history
C# Version 1
- Statements
- any piece of conde consists of one or more statements that are processed in execution order
- Classes
- Structs
- Interfaces
- Events
- Properties
- Delegates
- (Custom) Operators
- Attributes
C# Version 2 (2005, VisualStudio 2005)
- Generics
- Partial Types
- Anonymous Methods / Delegates / Func
- Nullable Value Types
- Iterators / Ienumerable
- Covariance/Contravariance
C# Version 3 (late 2007, VisualStudio 2008)
- Auto-implemented properties
- Anonymous Types
- Query Expressions
- Lambda Expressions
- Extension methods
- Extensions handle null differently.
- May indicate an extension method by adding name-suffix "Ext"
- Implicitly typed local variables (var)
- Partial methods
- Object / Collection Initializers
C# Version 4 (VisualStudio 2010)
- Dynamic Binding
- Named / optional arguments
- Generic covariant and contravariant
- Embedded interop types
C# Version 5 (VisualStudio 2012)
- Async
- Caller info attributes
C# Version 6 (VisualStudio 2015)
- Static Imports
- Exception Filters
- Auto-Property-Initializers
- Expression Bodies Members
- Null Propagator
- String interpolation
- Nameof
C# Version 7 (VisualStudio 2017)
- Out variables
- Tuples / Deconstruction
- Pattern matching
- Local functions
- Expanded expression bodies members
- Ref locals and returns
- Discards
- Binary literals and digit separators
- throw EXPRESSIONS
C# Version 7.1
- Async main
- Default literal expressions
- Inferred tuple element names
- Patternmatching on generic type parameters
C# Version 7.2
- Stackalloc array initializer
- Fixed
- Ref local stuff
- Readonly struct
- Ref readonly return
- Ref struct
C# Version 8
- Readonly members
- Default interface methods
- Pattern Matching:
- Switch expressions
- Property patterns
- Tuple patterns
- Positional patterns
- Using declarations (var will be disposed at the end of the scope)
- Static local functions
- Disposable ref structs
- Nullable reference types
- Async streams
- Indices / ranges
- Null-coalescing assignment
- Unmanaged constructed types
- Stackalloc in nested expressions
- Enhancement on interpolated verbatim strings
C# Version 9
- Records
- Init only setters
- Top-level statements
- Pattern matching enhancements
- Performance and interop
- Native sized integers
- Function pointers
- Suppress emitting localsinit flag
- Fit and finish features
- Target-typed new expressions
- static anonymous functions
- Target-typed conditional expressions
- Covariant return types
- Extension GetEnumerator support for foreach loops
- Lambda discard parameters
- Attributes on local functions
- Support for code generators
- Module initializers
- New features for partial methods
C# Version 10
- Record structs
- Improvements of structure types
- Interpolated string handlers
- global using directives
- File-scoped namespace declaration
- Extended property patterns
- Improvements on lambda expressions
- Allow const interpolated strings
- Record types can seal ToString()
- Improved definite assignment
- Allow both assignment and declaration in the same deconstruction
- Allow AsyncMethodBuilder attribute on methods
- CallerArgumentExpression attribute
- Enhanced #line pragma