skip to content

In upgrade notes for a C# service moving from .NET 8 to .NET 10, which headline features did C# 12, 13 and 14 add?

level: middleimportance: must knowfreq 55%

answer

  1. one language release per .NET release
  2. 12: constructors on any class, brackets
  3. 13: params beyond arrays, a lock type
  4. 14: members added from outside a type

basics

~20 s

C# 12 (.NET 8) added primary constructors for all classes and structs and collection expressions; C# 13 (.NET 9) params collections and System.Threading.Lock support; C# 14 (.NET 10) extension blocks, the field keyword and implicit span conversions.

solid answer

~50 s

Each C# release ships with one .NET release. **C# 12** (.NET 8): primary constructors on any `class` or `struct`, collection expressions such as `[1, 2, ..rest]`, default lambda parameters, `using` aliases for any type, inline arrays, `ref readonly` parameters and `[Experimental]`. **C# 13** (.NET 9): `params` on spans and collection types, `lock` recognising `System.Threading.Lock`, the `\e` escape, `ref struct` interfaces and `allows ref struct`, partial properties and indexers, and `[OverloadResolutionPriority]`. **C# 14** (.NET 10): extension blocks with extension properties and static extension members, the `field` keyword, implicit `Span<T>` and `ReadOnlySpan<T>` conversions, `nameof(List<>)`, lambda parameter modifiers without types, `?.` on the left of an assignment, partial constructors and events, and user-defined compound assignment. A .NET 8 to .NET 10 move crosses both C# 13 and C# 14, so the notes cover both releases and their breaking changes.

go deeper

for a junior

Recall one or two headline features per release and the .NET release each shipped with: C# 12 with .NET 8, C# 13 with .NET 9, C# 14 with .NET 10.

for a middle

Place each feature in the right release and say what it replaces in daily code, for example collection expressions replacing new List<T> { ... } initializers.

for a senior

Tie the list to a real upgrade: a jump from .NET 8 to .NET 10 crosses two language releases, so both releases' breaking-change notes apply to the codebase.

for a principal

Treat the feature list as input to a team decision: which features become house style, which are restricted, and how preview features stay out of shipped code.

## How C# releases line up with .NET Since C# 9 and .NET 5, a new **language version** has shipped with each yearly .NET release, inside the same SDK. The language version is the set of syntax and rules the C# compiler accepts; the **target framework** (`net8.0`, `net10.0`) is the runtime and library set a project builds against. By default the SDK picks the language version from the target framework, so moving a project from `net8.0` to `net10.0` moves it from C# 12 to C# 14 in one step. The details of that mapping, and of overriding it, belong to the lesson on language versions and targets. | C# version | Ships with | Support model of that .NET | Headline features | |---|---|---|---| | **C# 12** | .NET 8 | LTS (previous) | primary constructors, collection expressions | | **C# 13** | .NET 9 | STS | `params` collections, `System.Threading.Lock` | | **C# 14** | .NET 10 | LTS (current) | extension blocks, the `field` keyword, first-class spans | ## C# 12 (.NET 8) - **Primary constructors** on any `class` or `struct`, not only records. On a non-record type the parameters stay in scope for the whole type body; the compiler does not turn them into public properties. - **Collection expressions**: `int[] ids = [1, 2, 3];`, with the spread element `..other` to inline another collection. - **Default lambda parameters**, such as `(int retries = 3) => ...`. - **Alias any type**: `using Point = (int X, int Y);`. - **Inline arrays**, a fixed-size buffer inside a struct. - **`ref readonly` parameters**. - **`[Experimental]`**, which makes the compiler warn when a caller uses a marked API. - **Interceptors**, an experimental preview feature that a project had to opt into per namespace. ## C# 13 (.NET 9) - **`params` collections**: `params` on `Span<T>`, `ReadOnlySpan<T>`, collection types and interfaces such as `IEnumerable<T>`, not only arrays. - **New lock object**: when the target of a `lock` statement is a `System.Threading.Lock`, the compiler uses that type's API instead of `Monitor`. - **The `\e` escape** for the ESC character, U+001B. - **Method group natural type improvements** and **implicit index access** (`^1`) in object initializers. - **`ref` locals and `unsafe` contexts** in iterators and `async` methods. - **`ref struct` types implementing interfaces**, and the **`allows ref struct`** anti-constraint on type parameters. - **Partial properties and indexers**. - **`[OverloadResolutionPriority]`**, letting a library author mark one overload as preferred. - The **`field` keyword** was available here only as a *preview* feature. ## C# 14 (.NET 10) - **Extension members**: `extension(...)` blocks that declare extension properties, extension methods and static extension members, including operators. - **The `field` keyword**, now a shipped feature: an accessor body can use the compiler-synthesized backing field without declaring one. - **Implicit span conversions** ("first-class spans") between arrays, `Span<T>` and `ReadOnlySpan<T>`. - **`nameof` on unbound generic types**: `nameof(List<>)` is `"List"`. - **Modifiers on simple lambda parameters**: `(out x) => ...` without writing the type. - **Null-conditional assignment**: `customer?.Name = value;`. - **Partial constructors and partial events**. - **User-defined compound assignment** operators such as `operator +=`. - **Ignored directives**: the compiler skips lines starting with `#:` or `#!`, which file-based apps use for build directives such as `#:property` and `#:package`. ## Turning the list into an upgrade note A list of features is half the note. For a team going from .NET 8 straight to .NET 10, the useful version is: 1. List what each skipped release adds, because the project jumps over C# 13 and lands on C# 14. 2. Read the compiler's breaking-change documents for both releases (Roslyn keeps one per .NET release), because new keywords and new conversions can change existing code. 3. Decide, per feature, whether the team adopts it, restricts it or leaves it to library code. 4. Leave how each feature works to its own lesson; the release note only says what arrived and what it costs to take on. ## What interviewers listen for Interviewers rarely expect every bullet. They listen for the headline features placed in the right release, an honest answer about which ones the candidate uses, and awareness that a language upgrade is not free: C# 14 alone made `field` and `extension` contextual keywords and changed which overloads accept arrays. A candidate who says "C# 13 gave us the `field` keyword" is half right; it was a preview there and shipped in C# 14.

  • Which of these features first appeared as a preview before it shipped?
    The `field` keyword: the .NET 9 SDK offered it in C# 13 only under `LangVersion` `preview`, and it became a regular feature in C# 14. C# 12's interceptors were also experimental, switched on per namespace with an MSBuild property. Preview features can still change before release, so a team tracks them apart from shipped ones.
  • Do C# 14 extension blocks replace classic `this`-parameter extension methods?
    No. Classic extension methods still compile and bind as before. Extension blocks add what the old form could not express, such as extension properties, static extension members and operators. The docs state both forms generate the same IL, so converting an existing extension method to the block form is binary and source compatible.
  • Which C# 13 feature changes generated code when only a field's type changes?
    The new lock object. When a `lock` statement's target is a `System.Threading.Lock`, the compiler emits a call to `Lock.EnterScope()` instead of `Monitor.Enter` and `Monitor.Exit`; the statement itself is unchanged. Converting the `Lock` to `object` falls back to Monitor-based locking, and the compiler warns with CS9216.

  • Primary constructors came with records in C# 9, so C# 12 added nothing there.
  • The field keyword and extension properties both shipped in C# 13.
  • System.Threading.Lock support is a C# 14 feature.
  • Collection expressions arrived together with params collections in C# 13.
  • Raising the language version never changes how existing code compiles.

Assumes C# 14 on the .NET 10 SDK; C# 12 shipped with .NET 8 and C# 13 with .NET 9.