[英]How to configure Debug.WriteLine output file?
System.Diagnostics.Debug.WriteLine
用于跟踪。
Funilly文件C:\\Users\\Public\\Documents\\UserNameFromProgramContext\\ProgramName.asserts
是在我的机器上创建的,但不是在另一个开发人员的文件上创建的。
我只想在VS的输出窗口中输出Debug.WriteLine
。
在哪里可以配置Debug.WriteLine
写入的位置?
简单:
Debug.Listeners.Add(new TextWriterTraceListener("c:\\temp\\test.txt"));
Debug.AutoFlush = true;
Debug.WriteLine("test");
所以只需使用Listeners集合来操作调试数据的写入位置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.