(Forum Q & A Drop) How to learn how to call the current method?

xiaoxiao2021-03-05  23

Using

System; using

System.Diagnostics; Namespace

StackTraceTestSt

{/ ** ////

/// Class1 Summary Description. /// Class class1 {/ ** //// /// The primary invested point of the application. /// [stathread] static void main (string [] args) {method2 (); // output method2} static private void method1 () {stacktrace st = new stacktrace (true); console.writeline (ST .Getframe (1) .getMethod (). Name.toString ());} static private void method2 () {method1 (); console.readline ();}}}

转载请注明原文地址:https://www.9cbs.com/read-37515.html

New Post(0)