.Net Reflection - Calling unexisting methods
- by Joaozinho das Couves
Lets say i call method M1 on class A using reflection.
The method does not exist.
Is there any way to put a handler on class A that says, "someone is trying to execute method M1"?
Or
Is it possible to add a method dinamically to a class? I want to add a method M1...Mn that always does MyStaticClass.DoAction("M1...Mn");
Something like:
string methodName = "M1".
A.AddMethod(methodname,x = MyStaticClass.DoAction(x));
Thanks