WriteLine() is a method of the Console class defined in the System namespace
This statement causes the message "Welcome!" to be displayed on the screen as shown below −
Example
using System;
namespace Demo {
class Test {
static void Main(string[] args) {
Console.WriteLine("Welcome!");
Console.ReadKey();
}
}
}Output
Welcome!
To display a char array using the Console.WriteLine.
Example
using System;
namespace Demo {
class Test {
static void Main(string[] args) {
char[] arr = new char[] { 'W', 'e'};
Console.WriteLine(arr);
Console.ReadKey();
}
}
}Output
We