I have a function
public void AddPerson(string name)
{
Trace.WriteLine(MethodBase.GetCurrentMethod());
}
The expected output is
void AddPerson(string name)
But I wanted that the methodname outputted has no parameters in it.
void AddPerson()
To do this reliably is going to be an issue, you are going to have to build it up i.e. return type, name, generic types, access modifiers etc.
E.g:
Output:
Pitfalls, you are chasing a moving target:
Output:
The other option is just regex out the parameters with something like this:
(?<=\().*(?<!\))
.