I am using a library in C# where a method requires that I pass the string name of a target method as a parameter.
I want to avoid using hardcoded strings for obvious reasons, so I will write an intermediate util method that takes a method, gets the name (presumably via reflection) and feeds it into the library method.
I expect the intermediate method to look something like this:
public void CallOtherMethod(???? inputMethod)
{
string methodName = inputMethod.Name; // This gives me the method without the namespace, right?
this.CallFinalMethod(methodName);
}
To be called like this:
this.CallOtherMethod(this.SomeOtherMethod);
However, I'm having some trouble figuring out the type required to do this.
How can I correctly define my method?
As a side note, I would happily write this as an extension method to the library, but this doesn't quite work with the way the library behaves.