private static Type CreateUnionTypeLookup(Type t) { object[] args = new object[2]; args[0] = t; object arg = ((object[])FSharpUtils.GetUnionCases(null, args)).First <object>(); return((Type)FSharpUtils.GetUnionCaseInfoDeclaringType(arg)); }
private static Type CreateUnionTypeLookup(Type t) { // this lookup is because cases with fields are derived from union type // need to get declaring type to avoid duplicate Unions in cache // hacky but I can't find an API to get the declaring type without GetUnionCases object[] cases = (object[])FSharpUtils.GetUnionCases(null, t, null); object caseInfo = cases.First(); Type unionType = (Type)FSharpUtils.GetUnionCaseInfoDeclaringType(caseInfo); return(unionType); }
private static Type CreateUnionTypeLookup(Type t) { object obj = ((object[])FSharpUtils.GetUnionCases(null, new object[] { t, null })).First <object>(); return((Type)FSharpUtils.GetUnionCaseInfoDeclaringType(obj)); }