Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
What is the difference between Write() and WriteLine() methods 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.
Let us see an example to learn about the difference between Write() and WriteLine() method −
Example
using System;
class Program {
static void Main() {
Console.Write("One");
Console.Write("Two");
// this will set a new line for the next output
Console.WriteLine("Three");
Console.WriteLine("Four");
}
}
Output
OneTwoThree Four
Advertisements
