mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-09 20:28:07 -05:00
Use Delegate.CreateDelegate
This commit is contained in:
parent
da562a18c0
commit
7086512cb8
|
|
@ -65,10 +65,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format(""{0} is not static"", m));
|
||||
}
|
||||
|
||||
return ($1) =>
|
||||
{
|
||||
m.Invoke(null, new object[] { $1 });
|
||||
};
|
||||
return (Action<$0>)Delegate.CreateDelegate(typeof(Action<$0>), null, m);
|
||||
}
|
||||
".Replace("$0", g).Replace("$1", a);
|
||||
|
||||
|
|
@ -91,10 +88,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format(""{0} is static"", m));
|
||||
}
|
||||
|
||||
return (s, $1) =>
|
||||
{
|
||||
m.Invoke(s, new object[] { $1 });
|
||||
};
|
||||
return (Action<S, $0>)Delegate.CreateDelegate(typeof(Action<S, $0>), m);
|
||||
}
|
||||
".Replace("$0", g).Replace("$1", a);
|
||||
|
||||
|
|
@ -117,10 +111,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format(""{0} is static"", m));
|
||||
}
|
||||
|
||||
return ($1) =>
|
||||
{
|
||||
m.Invoke(instance, new object[] { $1 });
|
||||
};
|
||||
return (Action<$0>)Delegate.CreateDelegate(typeof(Action<$0>), instance, m);
|
||||
}
|
||||
".Replace("$0", g).Replace("$1", a);
|
||||
|
||||
|
|
@ -143,7 +134,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format(""{0} is not static"", m));
|
||||
}
|
||||
|
||||
return ($1) => (T)m.Invoke(null, new object[] { $1 });
|
||||
return (Func<$0, T>)Delegate.CreateDelegate(typeof(Func<$0, T>), null, m);
|
||||
}
|
||||
".Replace("$0", g).Replace("$1", a);
|
||||
|
||||
|
|
@ -166,7 +157,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format(""{0} is static"", m));
|
||||
}
|
||||
|
||||
return (s, $1) => (T)m.Invoke(s, new object[] { $1 });
|
||||
return (Func<S, $0, T>)Delegate.CreateDelegate(typeof(Func<S, $0, T>), m);
|
||||
}
|
||||
".Replace("$0", g).Replace("$1", a);
|
||||
|
||||
|
|
@ -189,7 +180,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format(""{0} is static"", m));
|
||||
}
|
||||
|
||||
return ($1) => (T)m.Invoke(instance, new object[] { $1 });
|
||||
return (Func<$0, T>)Delegate.CreateDelegate(typeof(Func<$0, T>), instance, m);
|
||||
}
|
||||
".Replace("$0", g).Replace("$1", a);
|
||||
|
||||
|
|
@ -218,10 +209,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is not static", m));
|
||||
}
|
||||
|
||||
return () =>
|
||||
{
|
||||
m.Invoke(null, new object[] { });
|
||||
};
|
||||
return (Action)Delegate.CreateDelegate(typeof(Action), null, m);
|
||||
}
|
||||
|
||||
public static Action<S> OpenAction<S>(MethodInfo m)
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is not static", m));
|
||||
}
|
||||
|
||||
return (a0) =>
|
||||
{
|
||||
m.Invoke(null, new object[] { a0 });
|
||||
};
|
||||
return (Action<A0>)Delegate.CreateDelegate(typeof(Action<A0>), null, m);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -31,10 +28,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is not static", m));
|
||||
}
|
||||
|
||||
return (a0, a1) =>
|
||||
{
|
||||
m.Invoke(null, new object[] { a0, a1 });
|
||||
};
|
||||
return (Action<A0, A1>)Delegate.CreateDelegate(typeof(Action<A0, A1>), null, m);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -45,10 +39,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is not static", m));
|
||||
}
|
||||
|
||||
return (a0, a1, a2) =>
|
||||
{
|
||||
m.Invoke(null, new object[] { a0, a1, a2 });
|
||||
};
|
||||
return (Action<A0, A1, A2>)Delegate.CreateDelegate(typeof(Action<A0, A1, A2>), null, m);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -59,10 +50,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is not static", m));
|
||||
}
|
||||
|
||||
return (a0, a1, a2, a3) =>
|
||||
{
|
||||
m.Invoke(null, new object[] { a0, a1, a2, a3 });
|
||||
};
|
||||
return (Action<A0, A1, A2, A3>)Delegate.CreateDelegate(typeof(Action<A0, A1, A2, A3>), null, m);
|
||||
}
|
||||
|
||||
//////////// OpenAction
|
||||
|
|
@ -74,10 +62,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is static", m));
|
||||
}
|
||||
|
||||
return (s, a0) =>
|
||||
{
|
||||
m.Invoke(s, new object[] { a0 });
|
||||
};
|
||||
return (Action<S, A0>)Delegate.CreateDelegate(typeof(Action<S, A0>), m);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -88,10 +73,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is static", m));
|
||||
}
|
||||
|
||||
return (s, a0, a1) =>
|
||||
{
|
||||
m.Invoke(s, new object[] { a0, a1 });
|
||||
};
|
||||
return (Action<S, A0, A1>)Delegate.CreateDelegate(typeof(Action<S, A0, A1>), m);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -102,10 +84,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is static", m));
|
||||
}
|
||||
|
||||
return (s, a0, a1, a2) =>
|
||||
{
|
||||
m.Invoke(s, new object[] { a0, a1, a2 });
|
||||
};
|
||||
return (Action<S, A0, A1, A2>)Delegate.CreateDelegate(typeof(Action<S, A0, A1, A2>), m);
|
||||
}
|
||||
|
||||
//////////// BindAction
|
||||
|
|
@ -117,10 +96,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is static", m));
|
||||
}
|
||||
|
||||
return (a0) =>
|
||||
{
|
||||
m.Invoke(instance, new object[] { a0 });
|
||||
};
|
||||
return (Action<A0>)Delegate.CreateDelegate(typeof(Action<A0>), instance, m);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -131,10 +107,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is static", m));
|
||||
}
|
||||
|
||||
return (a0, a1) =>
|
||||
{
|
||||
m.Invoke(instance, new object[] { a0, a1 });
|
||||
};
|
||||
return (Action<A0, A1>)Delegate.CreateDelegate(typeof(Action<A0, A1>), instance, m);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -145,10 +118,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is static", m));
|
||||
}
|
||||
|
||||
return (a0, a1, a2) =>
|
||||
{
|
||||
m.Invoke(instance, new object[] { a0, a1, a2 });
|
||||
};
|
||||
return (Action<A0, A1, A2>)Delegate.CreateDelegate(typeof(Action<A0, A1, A2>), instance, m);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -159,10 +129,7 @@ namespace UniJSON
|
|||
throw new ArgumentException(string.Format("{0} is static", m));
|
||||
}
|
||||
|
||||
return (a0, a1, a2, a3) =>
|
||||
{
|
||||
m.Invoke(instance, new object[] { a0, a1, a2, a3 });
|
||||
};
|
||||
return (Action<A0, A1, A2, A3>)Delegate.CreateDelegate(typeof(Action<A0, A1, A2, A3>), instance, m);
|
||||
}
|
||||
|
||||
//////////// StaticFunc
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user