Static Constructors : Static constructor : Class C# Examples


C# Examples » Class » Static constructor »

 

Static Constructors









    
using  System;

class  MyClass
{
        static  MyClass()
        {
                Console.WriteLine("MyClass  is  initializing");
        }
        public  static  int  I;
}

class  MainClass{
        public  static  void  Main()
        {
                MyClass.I  =  1;
        }
}
    
   
  
   



Output

MyClass is initializing


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Static constructor