83 lines
3.6 KiB
Markdown
83 lines
3.6 KiB
Markdown
Features Added in C# Language Versions
|
|
====================
|
|
|
|
# [C# 1.0](https://en.wikipedia.org/wiki/Microsoft_Visual_Studio#.NET_.282002.29) (Visual Studio.NET)
|
|
|
|
- Classes
|
|
- Structs
|
|
- Interfaces
|
|
- Events
|
|
- Properties
|
|
- Delegates
|
|
- Expressions
|
|
- Statements
|
|
- Attributes
|
|
- Literals
|
|
|
|
# [C# 2](https://msdn.microsoft.com/en-us/library/7cz8t42e(v=vs.80).aspx) (VS 2005)
|
|
- Generics
|
|
- Partial types
|
|
- Anonymous methods
|
|
- Iterators
|
|
- Nullable types
|
|
- Getter/setter separate accessibility
|
|
- Method group conversions (delegates)
|
|
- Co- and Contra-variance for delegates and interfaces
|
|
- Static classes
|
|
- Delegate inference
|
|
|
|
# [C# 3](https://msdn.microsoft.com/en-us/library/bb308966.aspx) (VS 2008)
|
|
- Implicitly typed local variables
|
|
- Object and collection initializers
|
|
- Auto-Implemented properties
|
|
- Anonymous types
|
|
- Extension methods
|
|
- Query expressions
|
|
- Lambda expression
|
|
- Expression trees
|
|
- Partial methods
|
|
|
|
# [C# 4](https://msdn.microsoft.com/en-us/magazine/ff796223.aspx) (VS 2010)
|
|
- Dynamic binding
|
|
- Named and optional arguments
|
|
- Generic co- and contravariance
|
|
- Embedded interop types ("NoPIA")
|
|
|
|
# [C# 5](https://blogs.msdn.microsoft.com/mvpawardprogram/2012/03/26/an-introduction-to-new-features-in-c-5-0/) (VS 2012)
|
|
- Asynchronous methods
|
|
- Caller info attributes
|
|
|
|
# [C# 6](https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-C%23-6) (VS 2015)
|
|
- [Draft Specification online](https://github.com/dotnet/csharplang/blob/master/spec/README.md)
|
|
- Compiler-as-a-service (Roslyn)
|
|
- Import of static type members into namespace
|
|
- Exception filters
|
|
- Await in catch/finally blocks
|
|
- Auto property initializers
|
|
- Default values for getter-only properties
|
|
- Expression-bodied members
|
|
- Null propagator (null-conditional operator, succinct null checking)
|
|
- String interpolation
|
|
- nameof operator
|
|
- Dictionary initializer
|
|
|
|
# [C# 7.0](https://blogs.msdn.microsoft.com/dotnet/2017/03/09/new-features-in-c-7-0/) (Visual Studio 2017)
|
|
- [Out variables](https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.0/out-var.md)
|
|
- [Pattern matching](https://github.com/dotnet/csharplang/blob/master/proposals/patterns.md)
|
|
- [Tuples](https://github.com/dotnet/roslyn/blob/master/docs/features/tuples.md)
|
|
- [Deconstruction](https://github.com/dotnet/roslyn/blob/master/docs/features/deconstruction.md)
|
|
- [Discards](https://github.com/dotnet/roslyn/blob/master/docs/features/discards.md)
|
|
- [Local Functions](https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.0/local-functions.md)
|
|
- [Binary Literals](https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.0/binary-literals.md)
|
|
- [Digit Separators](https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.0/digit-separators.md)
|
|
- Ref returns and locals
|
|
- [Generalized async return types](https://github.com/dotnet/roslyn/blob/master/docs/features/task-types.md)
|
|
- More expression-bodied members
|
|
- [Throw expressions](https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.0/throw-expression.md)
|
|
|
|
# [C# 7.1](https://github.com/dotnet/roslyn/blob/master/docs/Language%20Feature%20Status.md) (Visual Studio 2017 version 15.3)
|
|
- [Async main](https://github.com/dotnet/csharplang/blob/master/proposals/async-main.md)
|
|
- [Default expressions](https://github.com/dotnet/csharplang/blob/master/proposals/target-typed-default.md)
|
|
- [Reference assemblies](https://github.com/dotnet/roslyn/blob/master/docs/features/refout.md)
|
|
- [Inferred tuple element names](https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.1/infer-tuple-names.md)
|
|
- [Pattern-matching with generics](https://github.com/dotnet/csharplang/blob/master/proposals/generics-pattern-match.md)
|