"We merged an early C# 15 preview feature into .NET 11 preview 3: unions.

Adds union declarations (`union Pet(Cat, Dog, Bird) { ... }`) and union types (attributed with `[Union]`).
They can be treated by pattern matching/switch expressions as a closed set for exhaustiveness. " -Julien Couvreur

https://github.com/dotnet/csharplang/blob/main/proposals/unions.md

#dotnet #csharp

csharplang/proposals/unions.md at main · dotnet/csharplang

The official repo for the design of the C# programming language - dotnet/csharplang

GitHub
@nietras Personally I would have preferred closed enums over unions, but I get it, trend chasing is important. Otherwise we would have never be blessed with the genius of single/multi-cast delegates.