The Real Story Behind C# 15 Union Types
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
C# 15 is introducing union types as syntactic sugar with exhaustiveness checking, currently available in preview with .NET 11. The video covers the new union type syntax, compares it with nominal sum types (using abstract base records) and anonymous sum types (like the OneOf library), and explains how union types work under the hood. Key benefits include the ability to create closed sets of types (including primitives), exhaustiveness checking in switch expressions, and cleaner code without explicit wrappers or casting. The implementation is compiler-generated type testing code, not a new runtime construct.
•15m watch time
25.5K Impressions1 Comment