C# 语言版本

时间:2022-05-10 01:06:21

(摘自:*)https://en.wikipedia.org/wiki/C_Sharp_(programming_language)

Versions

Version Language specification Date .NET Framework Visual Studio
ECMA ISO/IEC Microsoft
C# 1.0 December 2002 April 2003 January 2002 January 2002 .NET Framework 1.0 Visual Studio .NET 2002
C# 1.1 and 1.2 October 2003 April 2003 .NET Framework 1.1 Visual Studio .NET 2003
C# 2.0 June 2006 September 2006 September 2005[c] November 2005 .NET Framework 2.0 Visual Studio 2005
C# 3.0 None[d] August 2007 November 2007

.NET Framework 2.0 (Except LINQ)[36]
.NET Framework 3.0 (Except LINQ)[36]
.NET Framework 3.5

Visual Studio 2008
Visual Studio 2010
C# 4.0 April 2010 April 2010 .NET Framework 4 Visual Studio 2010
C# 5.0 In Progress[37] None[d] June 2013 August 2012 .NET Framework 4.5 Visual Studio 2012
Visual Studio 2013
C# 6.0 None[d] Draft July 2015 .NET Framework 4.6 Visual Studio 2015
C# 7.0 None March 2017 .NET Framework 4.6.2 Visual Studio 2017
C# 7.1 None None None August 2017 .NET Framework 4.6.2 Visual Studio 2017

New features

C# 2.0
C# 3.0
C# 4.0
  • Dynamic binding[41]
  • Named and optional arguments[41]
  • Generic co- and contravariance[41]
  • Embedded interop types ("NoPIA")[41]
C# 5.0[42]
  • Asynchronous methods[43]
  • Caller info attributes[43]
C# 6.0
  • Compiler-as-a-service (Roslyn)
  • Import of static type members into namespace[44]
  • Exception filters[44]
  • Await in catch/finally blocks[44]
  • Auto property initializers[44]
  • Default values for getter-only properties[44]
  • Expression-bodied members[44]
  • Null propagator (null-conditional operator, succinct null checking)[44]
  • String interpolation[44]
  • nameof operator[44]
  • Dictionary initializer[44]
C# 7.0[45]
  • Out variables
  • Pattern matching
  • Tuples
  • Deconstruction
  • Local functions
  • Digit separators
  • Binary literals
  • Ref returns and locals
  • Generalized async return types
  • Expression bodied constructors and finalizers
  • Expression bodied getters and setters
C# 7.1[46]
    • Async main
    • Default literal expressions
    • Inferred tuple element names
  • C# 语言版本