Hacker News new | ask | show | jobs
by metek 22 days ago
https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...

Pattern matching is in C# unless I misunderstood you.

1 comments

You are right about the pattern matching, so it's on me that I didn't write clearly enough, what I meant is that I wish C# had Rust's compiler enforced exhaustive pattern matching over enums and the ability to carry data payloads:

https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html

Instead of .NET 11's more awkward (imo) `union` form.

https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...