ECMA-334 C# Language Specification

8.1: Getting started (informative)

The canonical "hello, world" program can be written as follows:
using System;  
class Hello  
{  
   static void Main() {  
      Console.WriteLine("hello, world");  
   }  
}  

The source code for a C# program is typically stored in one or more text files with a file extension of .cs, as in hello.cs. Using a command-line compiler, such a program can be compiled with a command line like
csc hello.cs  
which produces an application named hello.exe. The output produced by this application when it is run is:
hello, world  

Close examination of this program is illuminating:

For C and C++ developers, it is interesting to note a few things that do not appear in the "hello, world" program.