Appendix C - C# Version Features
This appendix provides a comprehensive index of C# features organized by version, with links to the relevant sections in the documentation where each feature is covered in detail.
C# 8.0 (2019)
Feature | Description | Documentation Link |
---|---|---|
Readonly Members | Add readonly modifier to struct members | Section 3.4.3 - Readonly Fields |
Default Interface Methods | Interfaces can now have method implementations | Section 3.5.5 - Default Interface Methods (C# 8+) |
Pattern Matching Enhancements | Switch expressions, property patterns, tuple patterns | Section 7.2.9 - Pattern Matching Enhancements (C# 9+) |
Using Declarations | Simplified using statement without braces | Section 7.1.5 - Using using Statements |
Static Local Functions | Local functions that can't capture local variables | Section 3.1.4 - Methods and Parameters |
Nullable Reference Types | Explicit annotation for nullable references | Section 2.3.2.4 - Nullable Type Conversions |
Asynchronous Streams | IAsyncEnumerable<T> for async iteration | Section 7.3.7 - Asynchronous Streams with IAsyncEnumerable<T> |
Indices and Ranges | New syntax for accessing arrays and collections | Section 2.5.4.1 - System.Array Methods |
C# 9.0 (2020)
Feature | Description | Documentation Link |
---|---|---|
Record Types | Reference types with value-based equality | Section 7.2.11 - Record Types (C# 9+) |
Init-only Properties | Properties that can only be set during initialization | Section 7.2.10 - Init-only Properties (C# 9+) |
Top-level Statements | Code without explicit Program class and Main method | Section 2.1.1 - C# Language Characteristics |
Pattern Matching Enhancements | Type patterns, relational patterns, logical patterns | Section 7.2.9 - Pattern Matching Enhancements (C# 9+) |
Target-typed New Expressions | Omit type in object creation when type is known | Section 3.1.2 - Creating and Using Objects |
Covariant Return Types | Override methods can return more derived types | Section 3.6.6 - Covariance and Contravariance |
Extension GetEnumerator | foreach can use extension GetEnumerator methods | Section 3.6.2 - Extension Methods |
Lambda Discard Parameters | Use _ for unused lambda parameters | Section 7.2.2 - Lambda Expressions |
Native Integers | nint and nuint types for platform-specific integers | Section 2.2.1 - Simple Types |
C# 10.0 (2021)
Feature | Description | Documentation Link |
---|---|---|
Record Structs | Value type records | Section 7.2.11.2 - Record Classes vs. Record Structs (C# 10+) |
Global Using Directives | Import namespaces for all files | Section 7.2.12 - Global Using Directives (C# 10+) |
File-scoped Namespaces | Simplified namespace declarations | Section 7.2.13 - File-scoped Namespaces (C# 10+) |
Extended Property Patterns | Nested property patterns | Section 7.2.9 - Pattern Matching Enhancements (C# 9+) |
Constant Interpolated Strings | const strings with interpolation | Section 4.4.4 - String Interpolation |
Lambda Improvements | Natural type for lambdas, attributes | Section 7.2.2 - Lambda Expressions |
DateOnly and TimeOnly | Date and time without the overhead of DateTime | Section 4.6.5 - DateOnly and TimeOnly (C# 10+) |
C# 11.0 (2022)
Feature | Description | Documentation Link |
---|---|---|
Required Members | Properties that must be initialized | Section 7.2.14 - Required Members (C# 11+) |
Raw String Literals | Multi-line strings with improved formatting | Section 7.2.15 - Raw String Literals (C# 11+) |
List Patterns | Pattern matching with lists and arrays | Section 7.2.9.5 - List Patterns (C# 11+) |
Auto-Default Structs | Structs can be created without initializing all fields | Section 2.2.2 - Complex Types |
Generic Attributes | Attributes can have type parameters | Section 7.2.3 - Reflection and Attributes |
UTF-8 String Literals | String literals with UTF-8 encoding | Section 4.4.1 - String Creation and Manipulation |
Pattern Matching on ReadOnlySpan | Use patterns with spans | Section 7.2.9 - Pattern Matching Enhancements (C# 9+) |
C# 12.0 (2023)
Feature | Description | Documentation Link |
---|---|---|
Primary Constructors | Constructor parameters in class declaration | Section 7.2.17 - Primary Constructors (C# 12+) |
Collection Expressions | Simplified collection initialization | Section 7.2.16 - Collection Expressions (C# 12+) |
Inline Arrays | Fixed-size arrays as value types | Section 2.5.1.1 - Definition and Declaration |
Optional Parameters in Lambda Expressions | Default values for lambda parameters | Section 7.2.2 - Lambda Expressions |
ref readonly Parameters | Parameters that are references but can't be modified | Section 3.1.4 - Methods and Parameters |
Alias Any Type | using directive can alias any type | Section 2.1.1 - C# Language Characteristics |
C# 13.0 (2024)
Feature | Description | Documentation Link |
---|---|---|
Interceptors | Intercept method calls at compile time | Section 7.2.18 - Interceptors (C# 13) |
Collection Expressions Enhancements | More collection types support | Section 7.2.16 - Collection Expressions (C# 12+) |
Semi-auto Properties | Properties with custom backing fields | Section 3.1.8 - Properties with Backing Fields |
params Collections | Support for params with collection types beyond arrays | Section 7.2.19 - Params Collections (C# 13) |
New lock Type and Semantics | Enhanced thread synchronization with System.Threading.Lock | Section 7.3.10 - Thread Synchronization with Lock Type (C# 13+) |
Partial Properties and Indexers | Support for partial properties and indexers in partial types | Section 3.1.14 - Partial Members (C# 13+) |
ref struct Interfaces | Allow ref struct types to implement interfaces | Section 3.5.6 - Ref Struct Interfaces (C# 13+) |
field Keyword | Access synthesized backing fields in property accessors | Section 3.1.8 - Properties with Backing Fields |
C# 14.0 (2025)
Feature | Description | Documentation Link |
---|---|---|
Extension Members | Enhanced extension methods and new extension properties | Section 7.2.20 - Extension Members (C# 14) |
Null-conditional Assignment | Use null-conditional operators on the left side of assignments | Section 7.2.21 - Null-conditional Assignment (C# 14) |
nameof with Unbound Generic Types | Use nameof with open generic types | Section 7.2.22 - Nameof Enhancements (C# 14) |
Implicit Span<T> Conversions | More implicit conversions for Span<T> and ReadOnlySpan<T> | Section 7.2.23 - Span Conversions (C# 14) |
Lambda Parameters with Modifiers | Add modifiers to lambda parameters without specifying types | Section 7.2.2 - Lambda Expressions |
field Backed Properties | Use field keyword to access synthesized backing fields | Section 3.1.8 - Properties with Backing Fields |
Partial Events and Constructors | Support for partial events and constructors in partial types | Section 3.1.14.3 - Partial Events and Constructors (C# 14+) |
Evolution of C# Features
Object-Oriented Programming
The evolution of object-oriented features in C#:
- C# 8.0: Default interface methods, readonly members
- C# 9.0: Records, init-only properties, covariant return types
- C# 10.0: Record structs, parameterless struct constructors
- C# 11.0: Required members, auto-default structs
- C# 12.0: Primary constructors
- C# 13.0: Semi-auto properties, partial properties and indexers, ref struct interfaces
- C# 14.0: Extension properties, field backed properties, partial events and constructors
Functional Programming
The evolution of functional programming features in C#:
- C# 8.0: Enhanced pattern matching, using declarations
- C# 9.0: Top-level statements, improved pattern matching
- C# 10.0: Lambda improvements, extended property patterns
- C# 11.0: List patterns
- C# 12.0: Collection expressions
- C# 13.0: Interceptors, params collections
- C# 14.0: Extension members, null-conditional assignment, lambda parameters with modifiers
Asynchronous Programming
The evolution of asynchronous programming features in C#:
- C# 5.0: async/await
- C# 8.0: Asynchronous streams (IAsyncEnumerable<T>)
- C# 9.0: Improved async pattern matching
- C# 10.0: AsyncMethodBuilder override
- C# 13.0: Ref locals and unsafe contexts in async methods
Recommended Learning Path
For developers new to C#, we recommend learning the features in this order:
- Core Language Features (C# 1-5): Classes, methods, properties, generics, LINQ, async/await
- Modern Syntax Improvements (C# 6-8): String interpolation, null-conditional operators, pattern matching
- Immutability Features (C# 9+): Records, init-only properties, required members
- Latest Productivity Features (C# 10-12): Global usings, file-scoped namespaces, primary constructors, collection expressions
- Advanced Language Features (C# 13-14): Interceptors, extension members, params collections, field keyword