I am wondering, generally in C#, the constructor concept is, base class cons should execute first, but why is that I am seeing derived class static constructor getting called and then base class cons. Could someone please explain ? 🙁
I am wondering, generally in C#, the constructor concept is, base class cons should
Share
Static constructors initialize the class itself, which is to say that they must be called before any other static members are accessed, and before the creation of any instances of the class.
As for the ordering of calls to static constructors within a class hierarchy, you should consider that undefined. From the MSDN page on static constructors: