Using system; using system. collections. generic; using system. LINQ; using system. text; namespace consoleapplication6 {class program {static void main (string [] ARGs (); stat2 st2 = new stat2 (); # endregion stat2.dosomething (); console. readkey () ;}} class STAT1 {public static STAT1 instance; // static STAT1 () // {// console. writeline ("STAT1 static structor"); //} public static void dosomething () {instance. do ();} static STAT1 () {console. writeline ("STAT1 static costructor"); instance = new STAT1 ();} Public Virtual Void Do () {console. writeline ("STAT1 do") ;}} class stat2: STAT1 {static stat2 () {console. writeline ("stat2 static costructor"); instance = new stat2 ();} public override Void Do () {console. writeline ("stat2 do ");}}}
If the base class STAT1 is not instantiated, its static method is called first.
However, if the stat2 subclass is not instantiated, it neither calls the constructor of the base class STAT1 nor its own static constructor.
Isn't that strange?