Difference between Write and Write Line

Write and write Line are two console applications in Microsoft visual C#.  Many people get confused between these applications but there exists the difference between these applications. Write is the predefined array of Unicode characters to standard yield stream whereas write Line compose the predefined array of Unicode characters, trailed by the present line eliminator, to the standard yield stream.

Write

Write strategy dwells inside the “Console” group which itself lives inside the System namespace. The Console class gives fundamental support to applications that write and read characters from and to the console. The write strategy outputs at least one values on screen with no another line character. This implies any ensuing output will be imprinted in a similar line.

Write Line

Write Line strategy likewise lives inside the “Console” group of the System namespace. The Write Line strategy prints at least one object on a solitary line with another line character embedded toward the end. This implies any ensuing output will be imprinted on another line.

Write VS Write Line

In this article we are going to explain the contrasts between write and write Line methods so that you can get the clear understanding about these terms.

  • Line:

The Write strategy is utilized to print at least one object on a solitary line without embeddings another line character toward the end.

The Write Line strategy embeds another line character later than printing the output.

  • Cursor:

In Write technique, the cursor stays at a similar line

 In Write Line method, cursor shifts to next line.

  • Line terminator:

Write does not incorporate a line terminator after string.

Write line includes a line terminator subsequent to the string.

  • Examples:

In case of Write method in C#, it will be written as follow

Console.Write(“Table”);

Console.Write(” “);

Console.Write(“Chair”);

Console.Write(” “);

Console.Write(“Desk”);

And output will be like

Table Chair Desk

In case of WriteLine method in C#, it will be written as given

Console.WriteLine(“Table”);

Console.WriteLine(“Chair”);

Console.WriteLine(“Desk”);

Additionally, the output will be

Table

Chair

Desk

Conclusion

In this article we can conclude that it’s your choice that what you like, you may utilize write and you may utilize Write Line which will make a line toward the end of the document first. At that point, affix or overwrite the document with the characters you indicate.