Can I find out the name of the method I am using?

Say I have some code like

namespace Portal
{
  public class Author
    {
        public Author() { }
        private void SomeMethod(){
          string myMethodName = ""; 
          //  myMethodName = "Portal.Author.SomeMethod()";
        }
    }
}

Can I find out the name of the method I am using? In my example I'ld like to programmatically set myMethodName to the name of the current method (ie in this case "Portal.Author.SomeMethod").

Thanks

Answers


MethodInfo.GetCurrentMethod().Name

Need Your Help

IE always sending the same jsessionid over time (using Java Wicket)

internet-explorer session wicket wicket-1.5

I have an application that I'm hosting on a local environment and am experiencing a very strange problem that occurs only in IE. The other browsers I've tested with (Chrome and Firefox) don't seem to

How do I store the window size between sessions in Qt?

qt window size restore

I have a QMainWindow in a Qt application. When I close it I want it to store its current restore size (the size of the window when it is not maximized). This works well when I close the window in r...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.