Union types (new in C# 15)
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
C# 15 introduces union types, declared with the union keyword, which represent a value that must be exactly one of a fixed set of case types. The compiler provides implicit conversions from each case type, exhaustiveness checking in switch expressions, and enhanced nullability tracking.