Could I get attribute names from ExcelFunction?

Jul 23, 2013 at 1:21 PM
Hi,

I do have code like this:
[ExcelFunction(Name="MyFuncName", Description="xxx" ...)]
public static object MyFuncName([ExcelArgument(Name="MyArguName", Description="xxx")] object arg)
{
  // inside the function, how could I get this function name - MyFuncName?
  // and how could I get argument name - MyArguName?
}

Thanks,

Sherry
Coordinator
Jul 23, 2013 at 1:58 PM
Hi Sherry,

I think you could get a MethodInfo for the current method using ````MethodInfo.GetCurrentMethod()``` and then get the attributes from there.

-Govert
Jul 23, 2013 at 2:06 PM
Thanks a lot, Govert. MethodInfo.GetCurrentMethod().Name works.