Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Microsoft.FSharp.Reflection
- let makeUnionCase<'T>(name: string) =
- let uci =
- FSharpType.GetUnionCases(typeof<'T>)
- |> Array.find (fun uci -> uci.Name = name)
- FSharpValue.MakeUnion(uci, [||]) :?> 'T
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement