I am getting a bunch of objects from an F# assembly, which I am then reflecting over to discover their value.
(To be precise I have a parser using fsYacc. I am then trying to display the results of the parse in a TreeView.)
One of the possible objects returned is this Discriminated union :
type op = Eq | Gt | Ge | Lt | Le
An object of this type will have a value, say Ge.
Is there any way using reflection that I can determine that an object is a Discriminated union, and hence take steps to determine its value?
To determine if it is a disriminated union – http://msdn.microsoft.com/en-us/library/ee353623.aspx –
FSharpType.IsUnionTo get value use
Reflection.UnionCaseInfo– http://msdn.microsoft.com/en-us/library/ee370473.aspx