Discriminated unions are now available in .NET 11 Preview 3 as a new language feature for C#. The new 'union' keyword lets you define a type that can be exactly one of several specified types at a time, similar to F# unions or Rust enums. The feature supports named unions, ad hoc unions (e.g., int | string | bool), nullable

12m watch time

Sort: