C# Versions and Features

The C# language, developed by Microsoft in conjunction with the .NET framework, serves as a powerful programming language while .NET acts as the underlying runtime support environment. Since its initial release in 2002 alongside the .NET Framework 1.0, C# has undergone significant evolution. It's worth noting that although the C# language and its compiler are distinct entities, they still rely on the .NET framework for seamless integration. One challenge arises from C#'s versioning as it is not tightly bound to a specific version of the .NET Framework, despite synchronized releases with Visual Studio.

The C# language utilizes a standard library defined in its specification, which encompasses various types and methods. These essential features are provided by the .NET platform through multiple packages, enabling developers to utilize the rich functionality provided by the framework.


C# compiler versions

History of C# Versions

C# Versions Visual Studio .NET Framework CLR version Year
Ver 1.0 VS 2002 1.0 1.0 2002
Ver 1.2 VS 2003 1.1 1.1 2003
Ver 2.0 VS 2005 2.0 2.0 2005
Ver 3.0 VS 2008 3.5 2.0 2007
Ver 4.0 VS 2010 4.0 4 2010
Ver 5.0 VS 2012 4.5 4 2013
Ver 6.0 VS 2015 4.6 4 2015
Ver 7.0 VS 2017 4.7 4 2017
Ver 8.0 VS 2019 4.8 4 2019

C# Versions and Features

C# Versions Visual Studio .NET Framework CLR version Year
Ver 1.0 VS 2002 1.0 1.0 2002
  1. Classes
  2. Structs
  3. Interfaces
  4. Events
  5. Properties
  6. Delegates
  7. Expressions
  8. Statements
  9. Attributes
  10. Literals
C# Versions Visual Studio .NET Framework CLR version Year
Ver 1.2 VS 2003 1.1 1.1 2003
  1. Dispose in foreach
  2. foreach over string specialization
C# Versions Visual Studio .NET Framework CLR version Year
Ver 2.0 VS 2005 2.0 2.0 2005
  1. Generics
  2. Partial types
  3. Anonymous methods
  4. Iterators
  5. Nullable types
  6. Getter/setter separate accessibility
  7. Method group conversions (delegates)
  8. Static classes
  9. Delegate inference
C# Versions Visual Studio .NET Framework CLR version Year
Ver 3.0 VS 2008 3.5 2.0 2007
  1. Implicitly typed local variables
  2. Object and collection initializers
  3. Auto-Implemented properties
  4. Anonymous types
  5. Extension methods
  6. Query expressions
  7. Lambda expression
  8. Expression trees
  9. Partial methods
C# Versions Visual Studio .NET Framework CLR version Year
Ver 4.0 VS 2010 4.0 4 2010
  1. Dynamic binding
  2. Named and optional arguments
  3. Co- and Contra-variance for generic delegates and interfaces
  4. Embedded interop types ("NoPIA")
C# Versions Visual Studio .NET Framework CLR version Year
Ver 5.0 VS 2012 4.5 4 2013
  1. Asynchronous methods
  2. Caller info attributes
C# Versions Visual Studio .NET Framework CLR version Year
Ver 6.0 VS 2015 4.6 4 2015
  1. Draft Specification online
  2. Compiler-as-a-service (Roslyn)
  3. Import of static type members into namespace
  4. Exception filters
  5. Await in catch/finally blocks
  6. Auto property initializers
  7. Default values for getter-only properties
  8. Expression-bodied members
  9. Null propagator (null-conditional operator, succinct null checking)
  10. String interpolation
  11. nameof operator
  12. Dictionary initializer
C# Versions Visual Studio .NET Framework CLR version Year
Ver 7.0 VS 2017 4.7 4 2017
  1. Out variables
  2. Pattern matching
  3. Tuples
  4. Deconstruction
  5. Discards
  6. Local Functions
  7. Binary Literals
  8. Digit Separators
  9. Ref returns and locals
  10. Generalized async return types
  11. More expression-bodied members
  12. Throw expressions
C# Versions Visual Studio .NET Framework CLR version Year
Ver 8.0 VS 2019 4.8 4 2019
  1. Nullable reference types
  2. Default interface members
  3. Recursive patterns
  4. Async streams
  5. Enhanced using
  6. Ranges and indexes
  7. Null-coalescing assignment
  8. Static local functions
  9. Unmanaged generic structs
  10. Readonly members
  11. Stackalloc in nested contexts
  12. Alternative interpolated verbatim strings
  13. Obsolete on property accessors

How to target different C# version in Visual Studio 2019

  1. Open the project properties window (right click on project, select properties)
  2. Select "Build" from the left hand side options
  3. Scroll down to the Advanced options
  4. Select the desired version of C#, click ok

C# Versions

The latest C# compiler determines a default language version based on your project's target framework(s). This is because the C# language may have features that rely on types or runtime components that are not available in every .NET implementation . The rules in this article apply to the compiler delivered with Visual Studio 2019 , or the .NET Core 3.0 SDK.

Target framework Version C# language version
.NET Core 3.x C# 8.0
.NET Core 2.x C# 7.3
.NET Standard 2.1 C# 8.0
.NET Standard 2.0 C# 7.3
.NET Standard 1.x C# 7.3
.NET Framework all C# 7.3

target different C# version

One thing you should be aware that the C# compilers that are part of the Visual Studio 2017 installation or earlier .NET Core SDK versions target C# 7.0 by default.