Let’s look at the different versions of C# and .NET, and the main features and functionalities incorporated in each of them.
We remember that in .NET there is a clear distinction between the Framework and the C# language. However, despite being separate, both C# and .NET have evolved hand in hand.
With each evolution, features and improvements have been incorporated into both. But of course, they are only available from a certain version onwards.
That is, for example, you can only use C# 8 features in .NET Core 1.0 or higher.
Of course, as they couldn’t make it easy, the versions of C# and .NET are not synchronized (they couldn’t make C# 7.0 go with .NET 7.0… No!).
So here is a list with the versions of both, and their release date.
C#
.NET version
1.0
.NET Framework 1.0
1.2
.NET Framework 1.1
2.0
.NET Framework 2.0
3.0
.NET Framework 3.5
4.0
.NET Framework 4.0
5.0
.NET Framework 4.5
6.0
.NET Framework 4.6
7.0
.NET Core 1.0
7.1
.NET Core 1.1
7.2
.NET Core 2.0
7.3
.NET Core 2.1
8.0
.NET Core 3.0
9.0
.NET 5.0
10.0
.NET 6.0 (LTS)
11.0
.NET 7.0
12.0
.NET 8.0 (LTS)
13.0
.NET 9.0
14.0
.NET 10.0 (LTS)
LTS = Long Time Service
And here is a summary of the main features incorporated by the C# language.
Features by version
C# 1.0 - July 2000
- Basic data types and classes: As an object-oriented language, C# introduced classes, structures, arrays, and enumerations.
- Namespace and exception handling: Support for namespaces (
namespace) and exception handling. - Delegate methods: Delegates allowed the implementation of callback design patterns, key for event programming.
C# 2.0 - November 2005
- Generics: One of the biggest additions, generics allowed creating classes and methods that work with any data type in a type-safe manner at compile time.
- Nullable types: Allows value types, such as
intandbool, to be assignednull. - Iterators and
yield: Facilitated the creation of custom iteration methods. - Anonymous types and co/contravariance: Features that improved the flexibility and control of collections and delegates.
C# 3.0 - November 2007
- LINQ (Language-Integrated Query): One of the most revolutionary additions, LINQ facilitated querying collections and databases directly in the language.
- Extension methods: Allow adding methods to existing classes without modifying their source code.
- Lambda expressions: Simplified the creation of anonymous functions.
- Auto-implemented properties: Simplified the syntax for properties in classes.
C# 4.0 - April 2010
- Optional and named parameters: Allow simplifying syntax in method calls.
dynamictype: Allows dynamic typing, useful for interoperability with languages like Python and COM libraries.- Improved support for parallel programming: Through the introduction of libraries like
Task Parallel Library(TPL).
C# 5.0 - August 2012
- Asynchronous programming (async/await): Simplified asynchronous programming, making task usage more manageable and avoiding UI blocking in desktop applications.
- Improvements in code debugging: The improvement in debug information generation facilitated code tracing.
C# 6.0 - July 2015
- String interpolation: Allows including expressions within strings in a simple way.
- Read-only properties: Using the
=>syntax, it’s possible to define read-only properties. nameofexpressions: To avoid text string errors when specifying property or variable names.- Null-conditional operator (
?.): Facilitates handling null values, avoidingNullReferenceException.
C# 7.0 - March 2017
- Tuples: Simplified returning multiple values from a function.
- Deconstruction: Allows assigning parts of tuples or structures to multiple variables in a single line.
- Pattern Matching: Introduced a way to perform pattern-based matching, useful for
switchexpressions. - Improvements in ref locals and return: Allows handling local references and return by reference.
- Local functions: Definition of functions inside other functions, useful for improving encapsulation.
C# 8.0 - September 2019
- Nullable Reference Types: Helps avoid null errors, one of the main sources of errors in programming.
- Ranges and indices: Simplified selecting subsets of collections and arrays.
- Interfaces with default methods: Allows defining default method implementations in interfaces.
- Asynchronous streams: For manipulating data in streams asynchronously.
- Improved patterns: Such as property patterns, tuple patterns, and positional patterns.
C# 9.0 - November 2020
- Records: Provides an easy way to create immutable classes with built-in comparison methods.
- Init-Only Setters: Allow properties to be configurable only during initialization.
withexpressions: Facilitate creating copies of immutable objects.- New pattern matching: Relational patterns and logical patterns.
- Top-level programs: Allow writing programs without explicitly defining a
Mainclass.
C# 10.0 - November 2021
- File-scoped namespaces: Facilitate namespace management in large files.
- Record struct types: Provides a record type for value structures.
- Lambda expression performance improvements: Lambdas are now faster and can have
staticparameters. - Auto-initialized properties: Greater ease in initializing properties.
- Constant string interpolation: Allows using string interpolation in constant expressions.
C# 11.0 - November 2022
- Generic parameters with
static: Allow using static types in generic definitions. - Reference pointers: Provide greater control in low-level memory operations.
- New string interpolation improvements: Simplification of string formatting with interpolation.
- Attributes on method bodies: Allows adding attributes to local expressions.
- Access permissions in record members: Greater control over access permissions in records.
C# 12.0 - November 2023
- Primary constructors: Allow initializing class properties directly in the class declaration.
- Collection expressions: Introduce a more concise syntax for creating and manipulating collections.
- Inline arrays: Facilitate defining fixed-size arrays within a data structure without needing an explicit length declaration.
- Optional parameters in lambda expressions: Lambdas can now have optional parameters.
ref readonlyparameters: Allow passing parameters by read-only reference.- Alias any type: Enables creating aliases for any type.
- Experimental attribute: Allows marking features or methods as experimental.
C# 13.0 - November 2024
- Collections in
paramsparameters: Allows passing collections directly toparamsparameters. - New
locktype and semantics: Introduces improvements in locking semantics. - New
\eescape sequence: Adds support for the\eescape sequence in strings. - Improvements in the natural type of method groups: Simplifies type inference when using method groups.
- Implicit indexer access in object initializers: Allows initializing object indexers directly within initializers.
ref localsandunsafecontexts in iterators and async methods: It is now possible to use local variables by reference and unsafe contexts within async methods and iterators.ref structtypes implementing interfaces: Enablesrefstructures to implement interfaces.ref structtypes as arguments for generic type parameters: Allows the use ofref structtypes as arguments in generics.- Partial properties and indexers: Properties and indexers can now be defined in partial types.
- Overload resolution with priority: Provides the ability to designate one overload as preferred over others.
