Discriminated unions in C# and .NET 11 (for real this time) (opens in new tab)
Back in 2023, I wrote about discriminated unions in C# and how C# developers had to work around the lack of language support using things like ASP.NET Core’s Results<> type or the OneOf NuGet package. Real C# language support (csharplang issue #113) had been open for years with no sign of a proper solution. Well, the wait is over. C# 15, shipping with .NET 11 (preview), introduces first-class union types. Let’s have a look.
Read the original article