Diffrence between Write and WriteLine Methods in C#

Introduction:

In this blog, we will see the difference between the Write and the WriteLine methods.

The Write () method outputs one or more values to the screen without a new line character.

The WriteLine() always appends a new line character to the end of the string. this means any subsequent output will start on a new line.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
class Program
{
    static void Main()
    {
        Console.Write("Box");     
        Console.Write("Table");     
        Console.Write("chair");    
        Console.WriteLine();      
       
Console.WriteLine("desk"); 
    }
}


Output of the program:

write1.gif

Ebook Download
View all
Learn
View all