The static constructor loads or called only once when any method of static class is invoked or initialize. There is no need of explicit calling of static constructor. But when there is no static property or method to do so then we can have explicit option to call static constructor as given below
typeof(StaticClassName).TypeInitializer.Invoke(null, null);
typeof(StaticClassName).TypeInitializer.Invoke(null, null);
No comments :
Post a Comment