How can I find the method that called the current method?

Posted by flipdoubt on Stack Overflow See other posts from Stack Overflow or by flipdoubt
Published on 2008-10-05T13:28:41Z Indexed on 2010/05/28 20:12 UTC
Read the original article Hit count: 349

Filed under:
|
|
|
|

When logging in C#, how can I learn the name of the method that called the current method? I know all about System.Reflection.MethodBase.GetCurrentMethod(), but I want to go one step beneath this in the stack trace. I've considered parsing the stack trace, but I am hoping to find a cleaner more explicit way, something like Assembly.GetCallingAssembly() but for methods.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET