更新时间:2023-11-19 11:03:04
有一个看System.Diagnostics$c$c>命名空间。很多好吃的东西在那里!
System.Diagnostics.StackTrace T =新System.Diagnostics.StackTrace();
这是真的好有一捅围绕学习什么引擎盖下怎么回事。
我建议你看看到日志记录解决方案(如NLOG,log4net的或Microsoft模式和实践企业库),它可以达到你的目的,然后一些。祝你好运队友!
I have a regular C# code. I have no exceptions. I want to programmatically log the current stack trace for debugging purpose. Example:
public void executeMethod()
{
logStackTrace();
method();
}
Have a look at the System.Diagnostics
namespace. Lots of goodies in there!
System.Diagnostics.StackTrace t = new System.Diagnostics.StackTrace();
This is really good to have a poke around in to learn whats going on under the hood.
I'd recommend that you have a look into logging solutions (Such as NLog, log4net or the Microsoft patterns and practices Enterprise Library) which may achieve your purposes and then some. Good luck mate!