Hello World Program in C#


Prev Tutorial Next Tutorial

Print Hello World Program in C#

This is very first program of any programming language here we write this code in C#. To display any message on screen we use WriteLine() the static method of Console class.

Print Hello World Program in C#

public class HelloWorld
{ 
  public static void Main()
  {
    Console.WriteLine("Hello World !");
  }
}

Output

Hello World !

Print Hello World Program in C# Using System

using System;

public class HelloWorld
{ 
  public static void Main()
  {
    Console.WriteLine("Hello World !");
  }
}

Output

Hello World !

Code Explanation

  • Every Main method must be contained inside a class (HelloWorld in this case).
  • The System.Console class contains a WriteLine method that can be used to display a string to the console.

Prev Tutorial Next Tutorial

Advertisements
Download Projects

Advertisements

Download WhatsApp Status Video

Buy This Ad Space Only $50 per Month, Ad Size 300X250 Contact on: [email protected] WhatsApp no. 8882538826

Google Adsense Advertisements