Firstly, is the F# 3.1 spec available online? If so, the answer for this should be easy enough to find.
I'm wondering if the compiled form of discriminated unions with named fields (added in 3.1) will include properties with the names of the fields, instead of the usual Item1
, Item2
, ... properties.
As far as I know, the specification is not available yet, so the only way to tell is to try it. I installed VS 2013 RC, so I thought I could check using this union:
As expected, it does generate named properties, which are nicely useable from C#:
In fact, it also uses the name in parameters of the construction functions:
If you're using them for C# interoperability, then you'll probably want to write the union member names in
PascalCase
, because the compiler does not automatically capitalize the name of the property if you use lowercase name (but interestingly, it does use a lowercase name for the parameters).