Explore union types in C# 15
Summary
The article introduces C# 15's union types, part of .NET 11 Preview 2, describing a closed set of case types and compiler-enforced exhaustive pattern matching. It shows how to declare unions, use implicit conversions, and pattern-match with switch expressions, including null-handling rules and real-world scenarios like OneOrMore<T>. It also covers custom unions, performance considerations, and how to start using union types in early previews.