-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Milestone
Description
Standard Unions
- Specification: Standard Unions
- Working group folder: Discriminated Unions
- Discussion: [Discussion]: Standard Unions #9567
Summary
A family of nominal type unions exist in the TBD namespace that can be used across assemblies as the standard way to specify a type union without needing to declare and name one.
public union Union<T1, T2>(T1, T2);
public union Union<T1, T2, T3>(T1, T2, T3);
public union Union<T1, T2, T3, T4>(T1, T2, T3, T4);
...
Union<int, string> x = 10;
...
var _ = x switch
{
int v => ...,
string v => ...
}