📅  最后修改于: 2021-05-30 00:32:38             🧑  作者: Mango
C#是通用的,现代且面向对象的编程语言,发音为“ C Sharp”。它是由Anders Hejlsberg和他的团队在.NET倡议下由Microsoft开发的,并得到了欧洲计算机制造商协会(ECMA)和国际标准组织(ISO)的批准。 C#的当前版本是C#7.3 。
下表显示了每个C#版本中引入的一些重要功能:
Version |
.NET Framework |
Visual Studio |
Major Features |
C# 1.0 |
.NET Framework 1.0 |
Visual Studio .NET 2002 |
- Classes
- Structs
- Interfaces
- Events
- Properties
- Delegates
- Expressions
- Statements
- Attributes
- Literals
|
C# 1.2 |
.NET Framework 1.1 |
Visual Studio .NET 2003 |
|
C# 2.0 |
.NET Framework 2.0 |
Visual Studio 2005 |
- Generics
- Partial types
- Anonymous methods
- Nullable types
- Iterators
- Covariance and contravariance
- Method group conversions (delegates)
- Static classes
- Delegate inference
- Getter/setter separate accessibility
|
C# 3.0 |
.NET Framework 2.0/3.0/3.5 |
Visual Studio 2008/2010 |
- Auto-implemented properties
- Anonymous types
- Query expressions
- Lambda expressions
- Expression trees
- Extension methods
- Implicitly typed local variables
- Partial methods
- Object and collection initializers
|
C# 4.0 |
.NET Framework 4 |
Visual Studio 2010 |
- Dynamic binding
- Named/optional arguments
- Generic covariant and contravariant
- Embedded interop types
|
C# 5.0 |
.NET Framework 4.5 |
Visual Studio 2012/2013 |
- Asynchronous members
- Caller info attributes
|
C# 6.0 |
.NET Framework 4.6 |
Visual Studio 2015 |
- Static imports
- Exception filters
- Auto-property initializers
- Expression bodied members
- Null propagator
- String interpolation
- nameof operator
- Index initializers
- Await in catch/finally blocks
- Default values for getter-only properties
|
C# 7.0 |
.NET Framework 4.6.2 |
Visual Studio 2017 |
- Out variables
- Tuples and deconstruction
- Pattern matching
- Local functions
- Expanded expression bodied members
- Ref locals and returns
- Discards
- Binary Literals and Digit Separators
- Throw expressions
|
C# 7.1 |
.NET Framework 4.7 |
Visual Studio 2017 version 15.3 |
- async Main method
- default literal expressions
- Inferred tuple element names
- Pattern matching on generic type parameters
|
C# 7.2 |
.NET Framework 4.7.1 |
Visual Studio 2017 version 15.5 |
- Techniques for writing safe efficient code
- Non-trailing named arguments
- Leading underscores in numeric literals
- private protected access modifier
- Conditional ref expressions
|
C# 7.3 |
.NET Framework 4.7.2 |
Visual Studio 2017 version 15.7 |
- You can access fixed fields without pinning.
- You can reassign ref local variables.
- You can use initializers on stackalloc arrays.
- You can use fixed statements with any type that supports a pattern.
- You can use additional generic constraints.
|
C# 8.0 |
.NET Core 3.0/.NET Standard 2.1 |
Visual Studio 2019 version 16.3 |
- Readonly members
- Default interface methods
- Pattern matching enhancements
- Switch expressions
- Property patterns
- Tuple patterns
- Positional patterns
- Using declarations
- Static local functions
- Disposable ref structs
- Nullable reference types
- Asynchronous streams
- Indices and ranges
- Null-coalescing assignment
- Unmanaged constructed types
- Stackalloc in nested expressions
- Enhancement of interpolated verbatim strings
|
参考:
- https://zh.wikipedia.org/wiki/C_Sharp_(programming_language)#Versions
- https://docs.microsoft.com/zh-cn/dotnet/csharp/whats-new/csharp-version-history