For performance-sensitive scenarios where case types include value types, libraries can also implement the non-boxing access pattern by adding a HasValue property and TryGetValue methods. This lets the compiler implement pattern matching without boxing.
Not necessarily, C#'s incremental source generators mean you could simply slap an attribute onto a class you want to use the non-boxing pattern with, and it'll just generate the pattern for you.