I am trying to use FSharpChoice type in a C# project. I have created a choice like so
var a = FSharpChoice<T1,T2,T3>.NewChoice1Of3(instofT1);
now how do I get instofT1 out of the choice type.
I see I can do a IsChoice1Of3 but how do i get to the value in the choice object?
Cast the value to
FSharpChoice<T1,T2,T3>.Choice1Of3and use theItemproperty.See Compiled Form of Union Types for Use from Other CLI Languages (archived, latest) in the F# spec for more information about how discriminated unions are represented.