When is a static constructor in C# called?
A static constructor is invoked by the first of either of the following conditions: Create an instance of the class. Refer any of the static methods of the class. Confused ? Read ahead… Example class Sample { static Sample() { Console.WriteLine(“static constructor called”); } public static void WriteTime() { Console.WriteLine(“Static method called”); } public static […]