I am using a generic handler in Visual Studio 2013.
What I am trying to do is to create a URL that incorporates the name of a method, but I want the name of the method to be real code so that it will not be hard-coded and follow along if the function name was changed.
If I were doing this in C or C++, I would have just said:
#define GENERATE_REFERENCE(text) #text
I don't really care it is formed as a method call as I have prototyped here
"Pseudo-code" in C# of what I am trying to do:
public class MyClass {
public void SayHello (String name)
{
...
}
public void GenerateLink()
{
url = "... "+GenerateReference(this.SayHello);
// url would be "... SayHello";
}
public String GenerateReference( DataType method )
{
// Is there some way to do this?
return method.MethodName.ToString();
}
}
My question is different than the suggested duplicate question get methodinfo from a method reference C# because my question comes from a place of great ignorance of C# mechanisms (neophyte). The suspected duplicate question implies a much higher level of understanding well beyond what I demonstrated in my question - I didn't know enough to ask that question. I would have never have found this answer from my searching.