Skip to content

Instantly share code, notes, and snippets.

View bleis-tift's full-sized avatar

bleis-tift bleis-tift

View GitHub Profile
let convert (inp:obj) : 'res =
inp |> unbox
let (?) (o : obj) (s:string) : 'a =
let ty = o.GetType()
let aty = typeof<'a>
if not (FSharpType.IsFunction aty)
then
let cs = CallSite<System.Func<CallSite, obj, obj>>.Create(Binder.GetMember(CSharpBinderFlags.None, s, null, [| CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) |]))
convert (cs.Target.Invoke(cs, o))