Static Main function

image_pdfimage_print

   

/*
Learning C# 
by Jesse Liberty

Publisher: O'Reilly 
ISBN: 0596003765
*/
 using System;
 namespace StaticTester
 {
     // create the class
    public class StaticTester
    {
       // Run is an instance method
       public void Run()
       {
           Console.WriteLine("Hello world");
       }

       // Main is static
       static void Main()
       {
           // create an instance
           StaticTester t = new StaticTester();

           // invoke the instance method
           t.Run();
       }
    }
 }

           
          


This is a simple C# program

image_pdfimage_print

   

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
/*  
   This is a simple C# program. 
 
   Call this program Example.cs. 
*/ 
 
using System; 
 
public class ExampleWriteLine { 
 
  // A C# program begins with a call to Main(). 
  public static void Main() { 
    Console.WriteLine("A simple C# program."); 
  } 
}