Created
October 15, 2009 12:17
-
-
Save JeremySkinner/210920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var handlerInterface = typeof(MyHandler).GetInterfaces()[0]; //This implements IHandle<T> (eg IHandle<Foo>) | |
var commandType = handlerInterface.GetGenericArguments()[0]; //this is the type being handled, eg Foo | |
var maker = GetType().GetMethod("ResolveHandler", BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance); | |
var compiledDelegate = (Func<object>)Delegate.CreateDelegate(typeof(Func<object>), maker); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment