Release analysis · November 12, 2026
C# 15 gives application developers new ways to describe outcomes, constrain inheritance and simplify everyday collection and loop code. The most useful starting point is an existing awkward model: a result returned as object, a hierarchy used only for switching, or repeated bookkeeping in nested loops.
Checked November 12, 2026. C# 15 is the default language version for projects targeting net11.0 with the .NET 11 SDK, according to Microsoft’s feature overview. The features below belong to the C# 15 language version and do not require the preview language flag, except for the separately identified memory-safety preview. This guide explains adoption decisions; it does not claim locally compiled examples.
Use unions for a known set of outcomes
A union describes a value drawn from declared case types. Microsoft documents implicit case conversions and exhaustiveness checking for switch expressions in its union reference. This is useful when a method has several expected outcomes that callers should handle explicitly.
Consider a product lookup that can succeed, find no product, or fail validation. First decide whether those outcomes are all ordinary application states. A connectivity outage may still belong in an exception or resilience policy. Once the expected cases are clear, make each carry the information its caller needs. Avoid an error case containing an unstructured string if the caller must reliably distinguish several failure categories.
Keep the first adoption internal to a component. A public result type becomes part of your compatibility contract: adding a case requires callers to reconsider their handling. That is useful pressure, but it is also maintenance work for consumers you may not control. Plan how the result maps to logs, HTTP responses and persistence rather than assuming the language model defines those formats.
Unions also have storage and nullability details. The reference documents boxing for value-type cases in a declared union and explains how default values and null patterns interact. Do not assume a union removes every null case or provides allocation-free storage. Review hot paths and initialization boundaries before treating it as a universal replacement for existing result types.
Choose closed hierarchies when you own inheritance
A closed class restricts direct derivation to its declaring assembly. The compiler can use that bounded set when checking patterns. Closed classes are implicitly abstract, and closure does not automatically extend through every descendant: a non-closed descendant can still allow further derivation elsewhere.
Use this for a state model whose variants belong to one library and whose behavior naturally shares a base type. A union is often a better fit when the alternatives already exist independently. Ask whether inheritance expresses a real relationship or merely groups values for a switch. That question matters more than choosing the newest syntax.
For a plugin API, decide whether external implementations are a requirement before closing the hierarchy. Restricting extension can simplify reasoning inside your application while breaking the intended customization model. Record the ownership boundary in the API documentation so future maintainers understand why the set is bounded.
Preserve collection semantics when shortening syntax
Collection expression arguments let a leading with(…) element supply construction or factory arguments, including comparers or capacity. That makes some initialization code more compact while retaining choices that previously required an explicit constructor call.
During a refactor, test the behavior that the argument controls. A case-insensitive set should still collapse differently cased duplicates; a sorted collection should preserve its ordering policy. Keep the target type clear where construction behavior matters. Reducing punctuation is a small benefit if a reviewer now has to search elsewhere to discover the comparer.
Adopt the syntax opportunistically in touched code rather than generating a large mechanical rewrite during the runtime upgrade. Small changes make semantic differences easier to identify and avoid burying an important collection-policy change inside formatting noise.
Review extension indexers for hidden work
C# 15 adds indexers within extension blocks. The extension declaration reference describes the named receiver requirement and member rules. This can make a domain abstraction easier to consume when indexing has a natural meaning.
Before adding one, ask what readers will expect from square brackets. If indexing a sequence repeatedly enumerates it, a short expression may conceal substantial work. If access performs I/O, consider whether an explicit method better communicates latency and failure. Document complexity and invalid-index behavior, and test the boundaries just as you would for an ordinary instance indexer.
Use labeled jumps only when the target is clearer
The updated jump-statement reference allows break and continue to name an enclosing labeled construct. In nested loops this can remove a flag whose only purpose is transporting control flow outward.
Choose labels that explain the domain operation. A reviewer should be able to see whether a failure skips an item, moves to the next batch, or stops the entire search. If a nested algorithm already mixes several exit policies, extracting a function may remain easier to understand. Test early exits and empty inputs before replacing the old bookkeeping.
Keep memory-safety evaluation explicit
Memory-safety changes remain preview. Microsoft’s overview distinguishes preview syntax and pointer relaxations from the additional updated-memory-safety-rules feature flag. Treat that work as a separate evaluation with unsafe-code owners, native interop tests and a written reason for enabling it. Upgrading the compiler is not a reason to switch on every preview feature.
For an initial C# 15 rollout, choose one internal model or refactor, update its tests and review its caller boundaries. That produces a useful local convention. A language upgrade succeeds when the next developer can reason about the code more easily, not when every new construct appears somewhere in the repository.