Version | Date | .NET Framework | Visual Studio |
---|---|---|---|
C# 1.0 | 2002.01 | .NET Framework 1.0 | VS 2002 |
C# 1.1 C# 1.2 |
2003.10 | .NET Framework 1.1 | VS 2003 |
C# 2.0 | 2005.11 | .NET Framework 2.0 | VS 2005 |
C# 3.0 | 2007.11 | .NET Framework 2.0 .NET Framework 3.0 .NET Framework 3.5 |
VS 2008 VS 2010 |
C# 4.0 | 2010.04 | .NET Framework 4 | VS 2010 |
C# 5.0 | 2012.08 | .NET Framework 4.5 | VS 2012 VS 2013 |
C# 6.0 | 2015.07 | .NET Framework 4.6 | VS 2015 |
C# 7.0 | 2017.03 | .NET Framework 4.6.2 | VS 2017 |
C# 7.1 | 2017.08 | .NET Framework 4.7 | VS 2017 v15.3 |
C# 7.2 | 2017.11 | .NET Framework 4.7.1 | VS 2017 v15.5 |
C# 7.3 | 2018.05 | .NET Framework 4.7.2 | VS 2017 v15.7 |
C# 8.0 | 2019.10 | .NET Framework 4.8 | VS 2019 v16.3 |
System.Enum
, System.Delegate
and unmanaged
constraints.= ref
).Span x = stackalloc[] { 1, 2, 3 };
.fixed
statement: Types that implement a suitable GetPinnableReference
can be used in a fixed
statement.out var
and pattern variables are allowed in field initializers, constructor initializers and LINQ queries.==
and !=
.[field: …]
attributes on an auto-implemented property to target its backing field.?
, notnull
constraint and annotations attributes in APIs, the compiler will use those to try and detect possible null
values being dereferenced or passed to unsuitable APIs.await foreach
and await using
allow for asynchronous enumeration and disposal of IAsyncEnumerable
collections and IAsyncDisposable
resources, and async-iterator methods allow convenient implementation of such asynchronous streams.using
declaration is added with an implicit scope and using
statements and declarations allow disposal of ref
structs using a pattern.i..j
syntax allows constructing System.Range
instances, the ^k
syntax allows constructing System.Index
instances, and those can be used to index/slice collections.??=
allows conditionally assigning when the value is null.static
cannot capture this
or local variables, and local function parameters now shadow locals in parent scopes.unmanaged
constraint).readonly
to indicate and enforce that they do not modify instance state.stackalloc
expressions are now allowed in more expression contexts.@$"..."
strings are recognized as interpolated verbatim strings just like $@"..."
.t is null
on unconstrained type parameter原文:https://www.cnblogs.com/zenronphy/p/12381738.html