I have a weird situation where I need to get the Name of the delegate as a string. I have a generic method that looks like this.
private T Get(T tas
You can get the name of the method call by making the parameter an expression instead of a delegate, just like Jon mentioned
private T Get(T task, Expression> method) where T : class
{
if (method.Body.NodeType == ExpressionType.Call)
{
var info = (MethodCallExpression)method.Body;
var name = info.Method.Name; // Will return "Bark"
}
//.....
}