I would like to get the name of the method that is being delegated as a Func.
Func<MyObject, object> func = x => x.DoSomeMethod();
string name = ExtractMethodName(func); // should equal "DoSomeMethod"
How can I achieve this?
-- For bragging rights --
Make ExtractMethodName also work with a property invocation, having it return the property name in that instance.
eg.
Func<MyObject, object> func = x => x.Property;
string name = ExtractMethodName(func); // should equal "Property"