All Articles

C# 버전별 언어 기능

C# 1 Classes
C# 2 Generics
Nullable value types
Method group conversions
Anonymous methods
Delegate covariance and contravariance
Iterators (yield return)
Partial types
Static classes
Separate getter/setter access on properties
Namespace alias qualifier :: syntax
The global **namespace alias
Extern aliases
Fixed-size buffers
InternalsVisibleToAttribute support
C# 3 Partial methods
Automatically implemented properties
Implicitly typed local variables (var)
Implicitly typed arrays (new[])
Object initializers
Collection initializers
Anonymous types
Lambda expressions (delegates)
Lambda expressions (expression trees)
Extension methods
Query expressions
C# 4 Dynamic typing
Optional parameters
Named arguments
Linked primary interop assemblies
Special rules for optional parameters in COM
Access to named indexers (COM only)
Generic variance for interfaces and delegates
Implementation change to lock statements
Implementation changes to field-like events
Field-like event access within the declaring class
C# 5 async / await
Changes to foreach iteration variable capture
Caller information attributes
C# 6 Read-only automatically implemented properties
Initializers for automatically implemented properties
Remove requirement to call this() in constructors for structs containing automatically implemented properties
Expression-bodied members
Interpolated string literals
The nameof operator
The using static directive
Object initializers using indexers
Collection initializers using extension Add methods
The null conditional ?. operator
Exception filters
Removed restrictions on awaiting in try/catch, try/finally, and try/catch statements
C# 7.0 Tuples
Deconstruction via Deconstruct methods
Initial patterns: constant patterns, type patterns, var **patterns
Use of patterns with the is **operator
Use of patterns in switch statements, including guard clauses (when)
Ref locals
Ref return
Binary integer literals
Underscore separators in numeric literals
Returning custom task types from async methods
More kinds of expression-bodied members
C# 7.1 The default **literal
Improvements to type patterns matching against generic values
Async entry points (async Task Main)
Inferred tuple element names
C# 7.2 Allow the conditional ?: operator to work with ref
ref readonly locals and return types
in parameters
Read-only structs
Extension methods with ref/in parameters
Ref-like structs
stackalloc support for Span<T>
Nontrailing named arguments
The private protected access modifier
Underscore separators in numeric literals directly after the 0x or 0b base specifier
C# 7.3 Access to fixed-sized buffers via fields without fixed statements
*==* and != operators for tuples
Use of pattern and out variables in field, property, and constructor initializers
Reassignment of ref locals
Initializers in stackalloc statements
Pattern-based fixed statements using GetPinnableReference
Generic type constraints now permitted on Enum and Delegate
New generic type constraint of unmanaged
Placement of attributes of fields backing automatically implemented properties
C# 8.0 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 string
C# 9.0
Init-only properties
- Init accessors and readonly fields
Records (data class)
- With-expressions
- Value-based equality
- Data members
- Positional records
- With-expressions and inheritance
- Value-based equality and inheritance
Top-level programs (omitting Main method)
Improved pattern matching
- Simple type patterns
- Relational patterns
- Logical patterns
- Target-typed new expressions
- Target typed ?? and ?:
Covariant returns