What's the difference between Console
.WriteLine()
vs Debug
.WriteLine()
?
What's the difference between Console
.WriteLine()
vs Debug
.WriteLine()
?
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.
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.).