How to Get the Current Executing Method in C# ?

Many times we need to know the current executing method in C# specially in catch of exception, there is simple way to do this.

catch (Exception ex)
 {
 string currMethod=new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().ToString(); }
Advertisements