Sometimes there is need to have some reflection for debugging. But the way like
System.Reflection.MethodBase.GetCurrentMethod().GetParameters().[0].Name
returns parameter name, not the actual function name. How to find out the 'real' name for the function in this case?
void OuterFunction(Func<string, int> f)
{
int result = f("input");
// how to get here function name 'g' instead of 'f'?
}
int g(string s)
{
Console.WriteLine(s);
return 0;
}
OuterFunction(g);