|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GetMethodName using Reflections NamespaceI have a question regarding reflections or any other method of getting the
method name of the current method... Does anyone have a method already built to capture the current method name? I'm sure this can be coded using reflections but have never used this namespace. I need a little help in the right direction or the code for a method to return this name. I'd like to call this method in my error handling code just before handling each error. I know I can also parse the .stacktrace to get this name as well. However, it just seems to me that this requirement should be coded from Reflections or a method call in the My namespace. Any help is greatly appreciated!!! JerryM MethodBase.GetCurrentMethod
http://msdn2.microsoft.com/en-us/library/system.reflection.methodbase.getcurrentmethod.aspx the help includes an example. Cheers, Greg Young MVP - C# http://codebetter.com/blogs/gregyoung Show quoteHide quote "JerryWEC" <JerryWEC@newsgroups.nospam> wrote in message news:eAYRFNatGHA.2260@TK2MSFTNGP03.phx.gbl... >I have a question regarding reflections or any other method of getting the >method name of the current method... > > Does anyone have a method already built to capture the current method > name? I'm sure this can be coded using reflections but have never used > this namespace. I need a little help in the right direction or the code > for a method to return this name. > > I'd like to call this method in my error handling code just before > handling each error. I know I can also parse the .stacktrace to get this > name as well. However, it just seems to me that this requirement should > be coded from Reflections or a method call in the My namespace. > > Any help is greatly appreciated!!! > > JerryM >
Other interesting topics
CultureInfo.NumericFormat and System.Convert
Unhandled Exception in Windows Service How to change DACL of a Windows Service in C#? Where is the parameter argument collection? .NET 2.0 Preventing ThreadAbortException. Modifying Security.config file create the array using reflection css issue Web Browser Help - Get URL of clicked link? |
|||||||||||||||||||||||