Hi,
I want to get an action delegate from a MethodInfo object. Is this possible?
Thank you.
Hi,
I want to get an action delegate from a MethodInfo object. Is this possible?
Thank you.
// Static method
Action action = (Action) Delegate.CreateDelegate(typeof(Action), method);
// Instance method (on "target")
Action action = (Action) Delegate.CreateDelegate(typeof(Action), target, method);
For an Action<T>
etc, just specify the appropriate delegate type everywhere.