LanguageVersion Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the language version.
public enum class LanguageVersion
public enum LanguageVersion
type LanguageVersion =
Public Enum LanguageVersion
Inheritance
Fields
Name
Value
Description
Default
0
The default language version, which is the latest supported version.
CSharp1
1
C# language version 1
CSharp2
2
C# language version 2
CSharp3
3
C# language version 3
Features: LINQ.
CSharp4
4
C# language version 4
Features: dynamic.
CSharp5
5
C# language version 5
Features: async, caller info attributes.
CSharp6
6
C# language version 6
Features:
Using of a static class Exception filters Await in catch/finally blocks Auto-property initializers Expression-bodied methods and properties Null-propagating operator ?. String interpolation nameof operator Dictionary initializer
CSharp7
7
C# language version 7.0
Features:
Out variables Pattern-matching Tuples Deconstruction Discards Local functions Digit separators Ref returns and locals Generalized async return types More expression-bodied members Throw expressions
CSharp7_1
701
C# language version 7.1
Features:
Async Main Default literal Inferred tuple element names Pattern-matching with generics
CSharp7_2
702
C# language version 7.2
Features:
Ref readonly Ref and readonly structs Ref extensions Conditional ref operator Private protected Digit separators after base specifier Non-trailing named arguments
CSharp7_3
703
C# language version 7.3
Features:
Indexing fixed fields does not require pinning ref local variables may be reassigned stackalloc arrays support initializers More types support the fixed statement Enhanced generic constraints Tuples support == and != Attach attributes to the backing fields for auto-implemented properties Method overload resolution improvements when arguments differ by 'in' Extend expression variables in initializers Improved overload candidates New compiler options (-publicsign and -pathmap)
CSharp8
800
C# language version 8.0
Features:
Readonly members Default interface methods Pattern matching enhancements (switch expressions, property patterns, tuple patterns, and positional patterns) Using declarations Static local functions Disposable ref structs Nullable reference types Asynchronous streams Asynchronous disposable Indices and ranges Null-coalescing assignment Unmanaged constructed types Stackalloc in nested expressions Enhancement of interpolated verbatim strings
CSharp9
900
C# language version 9.0
Features:
Records Init only setters Top-level statements Pattern matching enhancements Native sized integers Function pointers Suppress emitting localsinit flag Target-typed new expressions Static anonymous functions Target-typed conditional expressions Covariant return types Extension GetEnumerator support for foreach loops Lambda discard parameters Attributes on local functions Module initializers New features for partial methods
CSharp10
1000
C# language version 10.0
Features:
Record structs Global using directives Lambda improvements Improved definite assignment Constant interpolated strings Mix declarations and variables in deconstruction Extended property patterns Sealed record ToString Source Generator v2 APIs Method-level AsyncMethodBuilder
CSharp11
1100
C# language version 11.0
Features:
Raw string literals Static abstract members in interfaces Generic attributes Newlines in interpolations List-patterns Required members Span<char> constant pattern Struct auto-default Nameof(parameter) Checked user-defined operators UTF-8 string literals Unsigned right-shift operator Relaxed shift operator Ref fields File-local types
CSharp12
1200
C# language version 12.0
Features:
Primary constructors Using aliases for any types Nameof accessing instance members Inline arrays Collection expressions Ref readonly parameters Lambda optional parameters
LatestMajor
2147483645
The latest major supported version.
Preview
2147483646
Preview of the next language version.
Latest
2147483647
The latest supported version of the language.
Applies to