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();
       }
    }
 }