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 there is a clear distinction between the Framework in .NET 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 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 do C# 7.0 goes with .NET 7.0… No!).
So here you have a list of the versions of both 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 incorporated in 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 for the implementation of callback design patterns, key for event programming.
C# 2.0 - November 2005
- Generics: One of the biggest additions, generics allowed for the creation of classes and methods that worked with any data type in a type-safe manner at compile time.
- Nullable types: Allows value types, such as
int
andbool
, to be assignednull
. - Iterators and
yield
: Facilitated the creation of custom iteration methods. - Anonymous types and co/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 querying collections and databases directly in the language easier.
- 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 of properties in classes.
C# 4.0 - April 2010
- Optional and named parameters: Allow for simplifying the syntax in method calls.
dynamic
type: Allows for 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 the use of tasks more manageable and avoiding UI blocking in desktop applications.
- Improvements in code debugging: Improvements in generating debugging information made code tracing easier.
C# 6.0 - July 2015
- String interpolation: Allows including expressions within strings easily.
- Read-only properties: Using the
=>
syntax, it is possible to define read-only properties. nameof
expressions: To avoid 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 matches based on patterns, useful for
switch
expressions. - Improvements in ref locals and return: Allows handling of local references and return 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.
- Interfaces with default methods: Allows defining default method implementations in interfaces.
- Asynchronous streams: For manipulating streaming data 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 settable 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
- Namespace at the file level: Facilitate managing namespaces in large files.
- Record struct types: Provides a record type for value structures.
- Performance improvements in lambda expressions: Lambdas are now faster and can have
static
parameters. - Properties with automatic initialization: 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 improvements in string interpolation: Simplification of string formatting with interpolation.
- Attributes in 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 the need for 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 the creation of 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 lock semantics.
- New escape sequence
\e
: Adds support for the escape sequence\e
in strings. - Improvements in method group natural 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: Now it is possible to use local variables by reference and unsafe contexts within async methods and iterators.ref struct
types implementing interfaces: Enables ref structs to implement interfaces.ref struct
types as arguments for generic type parameters: Allows the use of ref 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 ability to designate an overload as preferred over others.