Let’s take a look at the different versions of C# and .NET, and the main features and functionalities that are 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.
In each evolution, features and improvements have been added to both. But of course, they are only available from a version onwards.
That is to say, for example, you can only use features of C# 8 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 of both versions and their release dates.
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 that the C# language incorporates.
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 enabled the implementation of callback design patterns, key for event programming.
C# 2.0 - November 2005
- Generics: One of the biggest additions, generics allowed the creation of classes and methods that could work with any data type in a type-safe manner at compile time.
- Nullable types: Allows value types, like
int
andbool
, to assignnull
. - Iterators and
yield
: Facilitated the creation of custom iteration methods. - Anonymous types and covariance/contravariance: Features that improved flexibility and control over collections and delegates.
C# 3.0 - November 2007
- LINQ (Language-Integrated Query): One of the most revolutionary additions, LINQ made it easier to query 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.
- Automatic properties: Simplified the syntax for properties in classes.
C# 4.0 - April 2010
- Optional and named parameters: Allow simplifying the syntax in method calls.
dynamic
type: 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): Allowed simplifying asynchronous programming, making it easier to manage tasks and avoiding UI thread blocking in desktop applications.
- Improvements in code debugging: Improved debugging information generation made it easier to track code.
C# 6.0 - July 2015
- String interpolation: Allows including expressions within strings in an easy manner.
- Read-only properties: Using the
=>
syntax, it’s possible to define read-only properties. nameof
expressions: To avoid string errors when specifying property or variable names.- Null conditional operator (
?.
): Eases the handling of null values, preventingNullReferenceException
.
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
switch
expressions. - Improvements in ref locals and return: Allows handling local references and returning by reference.
- Local functions: Definition of functions within 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.
- Interface with default methods: Allows defining default method implementations in interfaces.
- Asynchronous streams: For manipulating data 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 set only during initialization.
with
expressions: Facilitate creating copies of immutable objects.- New matching patterns: Relational patterns and logical patterns.
- Top-level programs: Allow writing programs without explicitly defining a
Main
class.
C# 10.0 - November 2021
- File-scoped namespaces: Facilitate namespace management in large files.
- Record structs: Provide a record type for value structures.
- Performance improvements for lambda expressions: Lambdas are now faster and can have
static
parameters. - Auto-init properties: Easier initialization of properties.
- Constant string interpolation: Allows using string interpolation in constant expressions.
C# 11.0 - November 2022
- Static generic parameters: Allow using static types in generic definitions.
- Reference pointers: Provide greater control in low-level memory operations.
- New improvements in string interpolation: 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: Now lambdas can have optional parameters.
ref readonly
parameters: Allow passing parameters by reference as read-only.- Any type alias: Enables creating aliases for any type.
- Experimental attribute: Allows marking features or methods as experimental.
C# 13.0 - November 2024
- Collections in parameters (
params
): Allows passing collections directly toparams
parameters. - New
lock
type and semantics: Introduces improvements in the locking semantics. - New escape sequence
\e
: Adds support for the escape sequence\e
in strings. - Improvements in natural method group type: Simplifies type inference when using method groups.
- Implicit access to indexers in object initializers: Allows initializing object indexers directly within initializers.
ref locals
andunsafe
contexts in iterators and async methods: It is now possible to use local variables by reference and unsafe contexts within async methods and iterators.ref struct
types implementing interfaces: Enablesref
structs to implement interfaces.ref struct
types as arguments for generic type parameters: Allows usingref struct
types as arguments in generics.- Partial properties and indexers: Now properties and indexers can be defined in partial types.
- Overload resolution with priority: Provides the capability to designate one overload as preferred over others.