DEV Community

.Net Trends
.Net Trends

Posted on

Type Unions for C# (aka discriminated unions)

A long-desired feature in C# is now proposed in the C# community. Type Unions (aka discriminated unions) are specified in a new proposal of the language committee's official C# language repository. This proposal aims to bring a new level of flexibility and type safety to C#, enabling developers to write more expressive and resilient code.
Type Unions will probably be added in one of the next releases after C# 13, which is nearly complete and shipping in November 2024.

More details: https://dotnetrends.net/type-unions-discriminated.html

Top comments (0)