问题描述
什么是Console.WriteLine()VS的Debug.WriteLine()?
What's the difference between Console.WriteLine() vs Debug.WriteLine()?
推荐答案
的写到标准输出流,无论是在调试或发布。 的Debug.WriteLine 写入跟踪侦听href="http://msdn.microsoft.com/en-us/library/system.diagnostics.debug.listeners.aspx" rel="nofollow">听众的集合,但只在运行时,
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()之间VS的Debug.WriteLine()的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!