Skip to content

ResourcesNews

.NET 11 adds C# unions as .NET 8 and 9 lose support

Microsoft's new release brings compiler-checked union types and faster tools, and its support ends the same day as the long-term .NET 10.

By Jason NguyenPublished 2 min read
A hand lifts a square block out of a tray holding a round block and a triangular block
Image: Illustration / Recaply

In short

  1. 01.NET 11 makes C# 15 the default language, with union types that let the compiler check every possible result.
  2. 02Microsoft lists .NET 11 and the long-term .NET 10 as both ending support in November 2028.
  3. 03.NET 11 changes decimal conversions, so a double holding 1.23 now converts to 1.229999999999999982236431606.

The story

Microsoft just shipped .NET 11, and C# 15 is now the default language for projects that target it. The headline addition is union types, which let a value be one of a fixed list of types.

It's a Standard Term Support release with two years of updates. Support for .NET 8 and .NET 9 ended the day it shipped. Microsoft's support policy also lists .NET 11 and the long-term .NET 10 as ending on the same day in November 2028.

C# 15 unions let the compiler check every outcome

A union names the types a result can be, such as a product or a not-found error. The compiler can then warn when a switch expression misses a case. Visual Studio Magazine pointed out one catch for speed-sensitive code, since the shorthand syntax boxes value types.

C# 15 also adds closed hierarchies, which limit direct inheritance to one assembly, plus extension indexers and labeled break and continue. Memory safety work and Runtime Async both remain in preview.

The tools get faster too. The SDK now uses a Native AOT command-line host by default, so commands like help and version skip the managed startup. The MSBuild server also stays warm between commands.

A .NET 11 rounding fix can change decimal values

Microsoft's compatibility notes flag a change that's easy to miss. Conversions between decimal and floating-point types are now correctly rounded. A double holding 1.23 used to convert to 1.23, and it now becomes 1.229999999999999982236431606.

That's more accurate, since the double was never exactly 1.23, but it can shift results in code that mixes the two types. Rebuilding with the .NET 11 SDK can also change compile-time constants, even in projects that target older versions. Microsoft's advice is to use decimal literals for decimal values.

The Hacker News launch thread drew 317 comments. Of the 28 top comments we read, about 10 praised C# or .NET, and three warned about breaking changes or the support window. That's a snapshot, not a survey.

C# finally has Sum types. Not quite discriminated unions, but close.

aryonoco on Hacker News

The .NET 11 SDK is on Microsoft's download page. It works with an up-to-date Visual Studio 2026, or with VS Code and the C# Dev Kit.

Why it matters

Unions are the main reason to look at .NET 11, since they move missing-case bugs from runtime to build time. The upgrade math is unusual too, because .NET 10 and .NET 11 end support together, so picking the newer release costs no support time. The real cost is testing, especially in code that converts between double and decimal.

Get Recaply Dev in your inboxFree, unsubscribe any time.

More stories