What's the coolest thing coming in the next version of C#?
Mads Torgersen introduces union types coming in C# 15, showing how they let you model a closed set of unrelated types, create union values, and switch over them with full strong typing, with notes on trying the feature today via preview tooling in Visual Studio and VS Code.
Overview
The video focuses on union types planned for C# 15.
What union types are for
- Model a closed set of unrelated types.
- Create union values from those types.
- Use strongly typed switching over the union.
Tooling and availability
- The feature is described as landing in C# 15 in November.
- There is a preview compiler available to try already in:
- Visual Studio
- VS Code