Hello world C# Example

(Last Updated On: January 9, 2019)

Hello world C# program- Creating Hello world C# program with steps to create project, namespace and class in Visual studio editor with important points explained.


Steps to Create a first Hello World program in C# in Visual studio editor

  • On top menu, Click File -> New -> Project
  • On New project window – > select visual C# template on left side ->select console application ->
    Enter a project name whatever you want. For example, C Sharp Course, -> Click OK, you should see below code.


Hello world program Example in C#


NOTE: // TODO Auto-generated method stub” in above program is just a comment that you can remove.

You can write Console.WriteLine(“Hello World”); in main() method as below.”



Save the file and run the program by clicking start button on top menu. Hello world string will be printed on console screen. for code debugging purpose press ctrl+F10.

Here is the output of above program

Hello World


Now you learned how to create a hello world program in C# programming. Focus on special notes given below.

Special Notes:

  • It is mandatory to have main() method to run an application/program. Because compiler find main method first to execute a program. If you don’t have the main() method, then compiler will complain that ‘helloworldExample.exe’ does not contain a static ‘Main’ method suitable for an entry point.



public class: class is public, so it can be accessible from anywhere in the project.

static: method can be called using class name without creating object of the class.

void: method does not return anything.

Main: method is the starting point of program execution.


Written By Shilpa Jaroli & Reviewed by Rakesh Singh