Last post Oct 28, 2013 09:20 PM by Prabha Sydney
Oct 28, 2013 06:45 PM|disearches|LINK
I have a classA which i have a static object A defined, and classA is inherited by my aspx pages.
Am doing this so instead of creating object A everytime the page is visited, it would basically be created once.
My question is: based on this design, does object A have a life cycle with the application such that it cannot be destroyed by a page (implicitly)
Oct 28, 2013 09:20 PM|Prabha Sydney|LINK
As is the case with all class types, the type information for a static class is loaded by the .NET Framework common language runtime (CLR) when the program that references the class is loaded. The program cannot specify exactly when the class is loaded.
However, it is guaranteed to be loaded and to have its fields initialized and its static constructor called before the class is referenced for the first time in your program. A static constructor is only called one time, and a static class remains in memory
for the lifetime of the application domain in which your program resides.
Shared from the below link