Hello World Program in C#
Advertisements
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.
Google Advertisment