Possible Duplicate:
get methodinfo from a method reference C#
This is most likely something simple but so far I have not come up with anything on how to do this.
I want to be able to get the name of a method in two different ways. Please note I want a method name, not a property name.
1) Inside of a class like ClassA<T>
, looking like:
var name = GetMethodName(x => x.MethodA);
2) Outside of a class, looking like:
var name = GetMethodName<ClassA<object>>(x => x.MethodA);
var name = GetMethodName<ClassB>(x => x.MethodB);
How might I do this exactly?
Thanks!