Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

What's the difference between Console.WriteLine() vs Debug.WriteLine()?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
565 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...