C# equivalent to Java's Exception.printStackTrace()?

后端 未结 8 1424
刺人心
刺人心 2021-01-31 13:13

Is there a C# equivalent method to Java\'s Exception.printStackTrace() or do I have to write something myself, working my way through the InnerExceptions?

8条回答
  •  闹比i
    闹比i (楼主)
    2021-01-31 13:43

    I would like to add: If you want to print the stack outside of an exception, you can use:

    Console.WriteLine(System.Environment.StackTrace);
    

提交回复
热议问题