No no. That is why this is an anonymous method. The name is automatically generated by the compiler and guaranteed to be unique. If you want to get the name of the calling method, you can pass it as an argument:
public static void Main() { Action<string> a = name => Console.WriteLine(name); a(MethodInfo.GetCurrentMethod().Name); }
or if you really want to have a meaningful name, you need to provide it:
public static void Main() { Action a = MeaningfullyNamedMethod; a(); } static void MeaningfullyNamedMethod() { Console.WriteLine(MethodInfo.GetCurrentMethod().Name); }
Darin Dimitrov
source share