views:

111

answers:

3

This is kind of a silly question, but is it possible to get the name of the method that is currently being executed from within that method?

Public Sub SomeMethod()

   Dim methodName as String = System.Reflection.[function to get the current method name here?]

End Sub

Thanks

+5  A: 

System.Reflection.MethodInfo.GetCurrentMethod();

herzmeister der welten
Thanks for the quick answer!
camainc
+2  A: 

Check this out: http://geekswithblogs.net/opiesblog/archive/2006/06/29/83654.aspx

Brian
That's actually how to get the name of the calling method, not the currently executing method. Still cool, though!
Marc Bollinger
A: 

should be available from stack trace

Aadith
.. if OP were using Java.
BalusC
yes..thanks BalusC for the ammendment :-)
Aadith