In C#, both Console.Write() and Console.WriteLine() are methods used to display output to the console window. The main difference between them lies in how they handle line breaks.
In C# programming, Console.Write() and Console.WriteLine() is a method used to output text to the console window. The main difference between them lies in how they handle the newline character ('\n').
Console.Write() is used to display output without a new line at the end, while Console.WriteLine() is used to display output with a new line at the end
Sam HobbsPosted Jun 5, 2023, 7:56 PM
I think it depends on options whether WriteLine adds just a Linefeed (10) or a Carriage Return (13) and Linefeed. In the following:
The output is:
In other words, WriteLine added a Carriage Return (13) and Linefeed (10).
And a fiddle for that is at:
https://dotnetfiddle.net/iTjjkI
Deepak RawatPosted Jun 5, 2023, 10:50 AM
In C#, both
Console.Write()andConsole.WriteLine()are methods used to display output to the console window. The main difference between them lies in how they handle line breaks.Vishal JoshiPosted Jun 5, 2023, 7:45 AM
In C# programming, Console.Write() and Console.WriteLine() is a method used to output text to the console window. The main difference between them lies in how they handle the newline character ('\n').
Abhishek YadavPosted Jun 3, 2023, 7:11 PM
Console.Write()is used to display output without a new line at the end, whileConsole.WriteLine()is used to display output with a new line at the end