Evolution and Major Releases:
C# has since undergone several major releases, with each version introducing new features and improvements to the language.
Some notable versions and their key features include:
C# 2.0 (2005): Introduced generics, anonymous methods, and nullable value types.
C# 3.0 (2007): Introduced LINQ (Language Integrated Query), automatic properties, extension methods, and lambda expressions.
C# 4.0 (2010): Introduced dynamic typing, named and optional parameters, and improved COM interoperability.
C# 5.0 (2012): Introduced async/await keywords for asynchronous programming.
C# 6.0 (2015): Introduced string interpolation, null-conditional operator, and static using directives.
C# 7.0 (2017): Introduced pattern matching, tuples, local functions, and more.
C# 8.0 (2019): Introduced nullable reference types, async streams, ranges and indices, and switch expressions.
C# 9.0 (2020): C# 9 was released with .NET 5. It's the default language version for any assembly that targets the .NET 5 release. It introduced record types, improved pattern matching, init-only properties, and more.
C# 10 (2021): C# 10 adds the following features and enhancements to the C# language:
• 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
C# 11 (2022): The following features were added in C# 11:
• Raw string literals
• Generic math support
• Generic attributes
• UTF-8 string literals
• Newlines in string interpolation expressions
• List patterns
• File-local types
• Required members
• Auto-default structs
• Pattern match Span on a constant string
• Extended nameof scope
• Numeric IntPtr
• ref fields and scoped ref
• Improved method group conversion to delegate
• Warning wave 7