Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

> The only grudge I have against them is they promised us discriminated unions since forever and they are still discussing how to implement it. I think that is the greatest feature C# is missing.

To ease the wait you could try Dunet (discriminated union source generator).

https://github.com/domn1995/dunet



There's also OneOf (https://github.com/mcintyre321/OneOf) as well which feels more ergonomic to me (having used both).

Practical example in a short write up here: https://chrlschn.dev/blog/2024/07/csharp-discriminated-union...


Isn't OneOf more like a type union, and not a tagged/discriminated union?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: