Console.WriteLine() 与 Debug.WriteLine()?
推荐答案Console.WriteLine 在调试或发布中写入标准输出流.Debug.WriteLine 写入跟踪侦听器Listeners 集合,但仅在运行时调试.在发布配置中编译应用程序时,Debug 元素不会被编译到代码中.
Console.WriteLine writes to the standard output stream, either in debug or release. Debug.WriteLine writes to the trace listeners in the Listeners collection, but only when running in debug. When the application is compiled in the release configuration, the Debug elements will not be compiled into the code.
作为 Debug.WriteLine 写入 侦听器 集合,这可能会在多个地方输出(Visual Studio 输出窗口、控制台、日志文件、注册侦听器的第三方应用程序(我相信 DebugView 会这样做),等等).
As Debug.WriteLine writes to all the trace listeners in the Listeners collection, it is possible that this could be output in more than one place (Visual Studio output window, Console, Log file, third-party application which registers a listener (I believe DebugView does this), etc.).
更多推荐
Console.WriteLine() 与 Debug.WriteLine() 有什么区别?
发布评论