How to write "Hello World" in C#?

CsharpProgrammingServer Side Programming

To print “Hello World” in C#, use the Console.WriteLine.

Let us see a basic C# program to display a text −

Example

 Live Demo

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");
raja
Published on 21-Aug-2018 13:40:09
Advertisements