c# - Static Constructor in derived class getting invoked first then the base class -
i wondering, in c#, constructor concept is, base class cons should execute first, why seeing derived class static constructor getting called , base class cons. please explain ? :(
static constructors initialize class itself, must called before other static members accessed, , before creation of instances of class.
as ordering of calls static constructors within class hierarchy, should consider undefined. msdn page on static constructors:
the user has no control on when static constructor executed in program.
Comments
Post a Comment