chiprook
← Software
SoftwareOctober 14, 2026, 12:08

C# 15 adds union types with compiler-checked exhaustive switches

C# 15, shipping with .NET 11 RC1, introduces union types that define a closed set of case types and let the compiler verify exhaustive pattern matching, emitting warning CS8509 when a new case is added. Unions compile to a struct holding an object?, so value-type cases are boxed and default yields an empty value.

C# 15 adds union types with compiler-checked exhaustive switches
#Microsoft#C##.NET
Read next
Software

C# 15 adds labeled break and continue for nested loops

Software

AWS adds instance-type contract to EC2 AMIs

Software

Fire Emblem: Fortune’s Weave Reviews Praise Tactical Combat, Warn Of Exhaustingly Long Runtime And Pacing Issues

Gadgets

Fujifilm's Instax Square 2 adds a switch to change photo mood