DEV Community

Discussion on: Pattern Matching F# Union Types in C# 7

Collapse
 
jeikabu profile image
jeikabu • Edited

Pattern matching was one of my favorite parts of F#.
With records looking like they'll be in c# 8.1 or 8.2, it makes me wonder how close DUs are.
Can you not do case var x when x is Abc.A:? Nevermind, Abc.A looks like it's the value not the type, how odd...

Collapse
 
stuartblang profile image
Stuart Lang

Yeah, DUs are the biggest thing I miss when going back to C#, I would love that.

Can you not do case var x when x is Abc.A:? Nevermind, Abc.A looks like it's the value not the type, how odd...

You're right, the type that gets generated is a little wierd and inuntuative to consume from C#, that's why I created this post, I've been back to it every now and then over the last few months.