internal static ResolveDelegate <T> Build <T>(DeserializeBuildTypeEnum buildTypeEnum, params object[] objs) { ParameterExpression[] pars = { ExpressionMembers.Reader, ExpressionMembers.JsonDeserializeHandler }; BlockExpression body = (BlockExpression)BuildMethodDics[buildTypeEnum].Invoke(null, objs); #if DEBUG Type t = typeof(T); DEBUGSURVEY.Add(t, body); #endif #if VIEW && NET45 var methodBuilder = typeBuilder.DefineMethod($"Deserialize_{typeof(T).Name}", System.Reflection.MethodAttributes.Static | System.Reflection.MethodAttributes.Public, typeof(T), new Type[] { typeof(JsonReader).MakeByRefType(), typeof(JsonDeserializeHandler) }); Expression.Lambda <ResolveDelegate <T> >( body, pars).CompileToMethod(methodBuilder); #endif ResolveDelegate <T> action = Expression.Lambda <ResolveDelegate <T> >(body, pars).Compile(); return(action); }
internal ExpressionBuildTypeAttribute(DeserializeBuildTypeEnum buildType) { _deserializeBuildType = buildType; }