To print “Hello World” in C#, use the Console.WriteLine.
Let us see a basic C# program to display a text −
Example
using System;
using System.Collections.Generic;
using System.Text;
namespace Program {
class MyApplication {
static void Main(string[] args) {
Console.WriteLine("Hello World");
Console.Read();
}
}
}Output
Hello World
Above, we displayed the text “Hello World” using the WriteLine() method. The output is displayed using the Console −
Console.WriteLine("Hello World");