#9662·csharplang

[Proposal]: Unions (VS 18.8, .NET 11)

Author: MadsTorgersenCreated Sep 4, 2025Updated Aug 13, 2026
LabelsProposal championImplemented Needs ECMA Spec

Unions

Note: This consolidates several previous proposals into one. Recent design meeting history for all of them is included below.

Summary

A set of interlinked features that combine to provide C# support for union types, including a declaration syntax and several useful behaviors.

csharp
public union Pet(Cat, Dog); // Declaration syntax

Pet pet = dog;              // Implicit conversion

_ = pet switch
{
    Cat cat => ...,         // Implicit matching
    Dog dog => ...,
}                           // Exhaustive switching

Design meetings