Method name at run time
C#
3
Posts
3
Posters
0
Views
1
Watching
-
How can I find out which the method name at run time? For example: Class Foo { int DoSomething() { //here is where I need to find out this method name at run time } }
-
How can I find out which the method name at run time? For example: Class Foo { int DoSomething() { //here is where I need to find out this method name at run time } }
// Get a new Stack trace, starting from this frame
StackTrace trace = new StackTrace(0);string currentMethodName = trace.GetFrame(0).GetMethod().Name;
string callingMethod = trace.GetFrame(1).GetMethod().Name;
Charlie if(!curlies){ return; }