Console.Write
puts text on the console window. Getting started with the Console can be confusing. We learn the difference between Console.Write and Console.WriteLine. We decide which one to choose. We even use them together.
Example
The Console.Write method requires the System namespace to be included at the top to get the fully qualified name. The Write method does not append a newline to the end of the Console.
Also, if you are printing a string that already has a newline, you can use Console.Write for an entire line. And when you call WriteLine with no parameters, it only writes a newline.
using System;
class Program
{
static void Main()
{
Console.Write("One "); // <-- This writes the word.
Console.Write("Two "); // <-- This is on the same line.
Console.Write("Three"); // <-- Also on the same line.
Console.WriteLine(); // <-- This writes a newline.
Console.WriteLine("Four"); // <-- This is on the next line.
}
}
Result is :--
One Two Three
Four