private static Func <object, object> CreateCastConverter(TypeConvertKey t) { var castMethodInfo = t.TargetType.GetMethod("op_Implicit", new[] { t.InitialType }) ?? t.TargetType.GetMethod("op_Explicit", new[] { t.InitialType }); if (castMethodInfo == null) { return(null); } var call = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall <object>(castMethodInfo); return(o => call(null, o)); }
private static Func <object, object> CreateCastConverter(TypeConvertKey t) { Type[] types = new Type[] { t.InitialType }; MethodInfo method = t.TargetType.GetMethod("op_Implicit", types); if (method == null) { Type[] typeArray2 = new Type[] { t.InitialType }; method = t.TargetType.GetMethod("op_Explicit", typeArray2); } if (method == null) { return(null); } MethodCall <object, object> call = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall <object>(method); return(o => call(null, new object[] { o })); }
private static Func <object, object> CreateCastConverter(TypeConvertKey t) { MethodInfo castMethodInfo = t.TargetType.GetMethod("op_Implicit", new[] { t.InitialType }); if (castMethodInfo == null) { castMethodInfo = t.TargetType.GetMethod("op_Explicit", new[] { t.InitialType }); } if (castMethodInfo == null) { return(null); } MethodCall <object, object> call = (o, a) => castMethodInfo.Invoke(o, a); return(o => call(null, o)); }
private static Func <object, object> CreateCastConverter(TypeConvertKey t) { MethodInfo method = t.TargetType.GetMethod("op_Implicit", new Type[1] { t.InitialType }); if (method == null) { method = t.TargetType.GetMethod("op_Explicit", new Type[1] { t.InitialType }); } if (method == null) { return(null); } MethodCall <object, object> call = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall <object>(method); return((object o) => call(null, o)); }
private static bool IsConvertStringToVector3(TypeConvertKey t) { return(string.Compare(t.InitialType.FullName, "System.String", StringComparison.CurrentCultureIgnoreCase) == 0 && string.Compare(t.TargetType.FullName, "UnityEngine.Vector3", StringComparison.CurrentCultureIgnoreCase) == 0); }
public bool Equals(TypeConvertKey other) { return(_initialType == other._initialType && _targetType == other._targetType); }