https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...
Pattern matching is in C# unless I misunderstood you.
Re:What's new in the .NET 11 runtime
by YuechenLi on Wednesday November 11, 2026 @09:14AM
(#50453682)
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...
I got so worked up by it I built my own TyepScript compiler with my clankers in C# to prove that it can be done, my revival of the Common Language Runtime concept, project Copeland:
https://github.com/yuechen-li-dev/copeland
Currently, Copeland compiles a dialect of TypeScript to JavaScript, C#, WASM via Blazor WebAssembly, and NativeAOT, runs in csproj, and uses xUnit.NET for testing framework.
(The other reason is that Microsoft still refuses to do the obvious thing in .NET 11 and take the best part of Rust and let enums be `match`ed, despite the fact that both TypeScript and C# have weak enums historically, so I added payload enums to my TypeScript dialect because Microsoft won't.)