Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

vb.net

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

like image 413
Zolomon Avatar asked Jun 10 '10 08:06

Zolomon


People also ask

What is the difference between system console WriteLine and console WriteLine?

So, if you're talking about System. Console. WriteLine in both cases, there's no difference.

What is difference between console log and console debug?

They are almost identical - the only difference is that debug messages are hidden by default in recent versions of Chrome (you have to set the log level to Verbose in the Devtools topbar while in console to see debug messages; log messages are visible by default).

What is debug WriteLine?

WriteLine(String) Writes a message followed by a line terminator to the trace listeners in the Listeners collection. WriteLine(Object) Writes the value of the object's ToString() method to the trace listeners in the Listeners collection.

What is the difference between write () and WriteLine () in C#?

The difference between Write() and WriteLine() method is based on new line character. Write() method displays the output but do not provide a new line character. WriteLine() method displays the output and also provides a new line character it the end of the string, This would set a new line for the next output.


1 Answers

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

like image 86
Sam Holder Avatar answered Sep 19 '22 10:09

Sam Holder