Console.WriteLine() 与 Debug.WriteLine() 有什么区别?

编程入门 行业动态 更新时间:2024-10-24 13:28:06
本文介绍了Console.WriteLine() 与 Debug.WriteLine() 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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() 有什么区别?

本文发布于:2023-05-28 12:29:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/320909.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么区别   Console   WriteLine   Debug

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!