I'm trying to get the method name passed into an Action delegate. This is what I have:
private static void DoAction(params Action<Group>[] actions)
{
foreach (Action<Group> action in actions)
{
Console.WriteLine(action.Method.Name);
}
}
And in main, this is how it gets called:
DoAction(y => y.DoBar(), z => z.DoFoo());
After the execution of DoAction() method I was hoping to see "DoFoo" and "DoBar" on the screen, but it instead I see <Main>b__0
and <Main>b__1
. I was just wondering if there's a way to get the actual name of the target method from an action delegate? Any help is appreciated.