Note: this class will be very inefficient for individual dynamic method calls - compilation of the expression is very expensive up front, so using this delegate factory makes sense only if you re-use the dynamicly loaded method repeatedly.
Entirely based on Nate Kohari's blog post: http://kohari.org/2009/03/06/fast-late-bound-invocation-with-expression-trees/
public static class DelegateFactory : object
Member | Description | |
---|---|---|
Create | Creates a LateBoundMethod delegate from a MethodInfo structure Basically creates a dynamic delegate instance (code) on the fly. public static LateBoundMethod Create(MethodInfo method);
public static LateBoundMethod Create(Type type,
string methodName, Type[] parameterTypes); |