The Delegate type is a supertype of all other delegate types:
void myFunction(Delegate func) { ... }
Then func.Method will provide you with a MethodInfo object that you can use to check return types and parameter types.
When calling a function, you need to explicitly specify which type of delegate you want to create:
myFunction((Func<int, int>) delegate (int x) { return 5 * x; });
Some idea of ββwhat you are trying to accomplish at a higher level would be good, as this approach may not be ideal.
cdhowie
source share