▲ | int_19h 2 days ago | ||||||||||||||||||||||||||||||||||
I wouldn't say "all" - C# doesn't have discriminated unions yet, which is kind of a big one, especially when you're also looking at pattern matching. A | |||||||||||||||||||||||||||||||||||
▲ | caspper69 2 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
It has been in discussion for quite some time. I believe they'll get there soon: (example) https://dev.to/canro91/it-seems-the-c-team-is-finally-consid... In the interim, MS demonstrates how C# 8.0+ can fake it pretty well with recursive pattern matching: https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... Not the same I know, and I would love me a true ADT in C#. Edit (a formal proposal): https://github.com/dotnet/csharplang/blob/18a527bcc1f0bdaf54... | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
▲ | feoren 2 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
While we wait for the official discriminated union feature, the OneOf package is a pretty good stand-in: https://github.com/mcintyre321/OneOf |