How to get a MethodBase for a method other than the current method
Posted on 2006-06-05
MethodBase.GetCurrentMethod() returns a MethodBase object for the current method. I need a way to return a MethodBase for a method other than the current method. I am doing this from a method which is an overridden version of the method of interest
GetMethodFromHandle() seems like it might work, but is it available in .NET 1.1? I think it may only be available in 2.0. Also it takes a MethodHandle - how do I get a MethodHandle for a given method?
Here is an example:
bar(--->MethodBase of foo(a), not foo(a,b)<---,a);
So, I want to call bar with the MethodBase of foo(a) in both functions. If I use GetCurrentMethod() in foo(a,b), it returns the MethodBase of foo(a,b), but what I want is the MethodBase of foo(a). (i.e. bar should not notice anything different between being called by foo(a) or foo(a,b)
Thanks in Advance,