Static Constructors : static constructor « Class « C# / CSharp Tutorial






using System;

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

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








7.43.static constructor
7.43.1.Static Constructors
7.43.2.Static constructor 2