For logging purposes, is there any Runtime facility to obtain the name (with
namepsaces) of a method from within?
That is, insgiven:
namespace A
{
class Foo
{
void Bar()
{
Log( TheFunctionNameHere instead of "A::Foo.Bar()");
}
}
}
I suppose I can extract this from a StackTrace object, but I suspect that
can be quite expensive.
TIA

Signature
------
Fernando Cacciola
SciSoft
http://certuscode.wordpress.com
http://fcacciola.50webs.com
http://fcacciola.wordpress.com
Mubashir Khan - 19 Jan 2007 14:22 GMT
System.Reflection.MethodBase.GetCurrentMethod().Name
> For logging purposes, is there any Runtime facility to obtain the name
> (with namepsaces) of a method from within?
[quoted text clipped - 16 lines]
>
> TIA
Fernando Cacciola - 19 Jan 2007 19:55 GMT
> System.Reflection.MethodBase.GetCurrentMethod().Name
Great.
Thank you
Fernando