ASP.NET 2.0: static instance of reference type is not always set to null

O

olrt

I'm still convinced that the behaviour of ASP.NET in respect to code
invoking static members is coherent with the documentation of the
static C# keyword...
By the way, you can also exploit ASP.NET "Application" context object
to store objects that are shared between all users of your Web
application...
But you'll have to ensure that all calls to methods of the object leave
it in a coherent state (that is you'll have to synchronize the threads
that call the methods which affect the state of the object).
I think that's what you did with your static methods...
 
M

michaelcoleman72

Statics are per app domains. App domains are per process. With Web
Farms and/or Web Gardens you'll have multiple app domains and hence the
potential for multiple static classes and/or values per AD. In
addition, static classes have changed between 1.x and 2.0. You should
read up on singletons for the correct implemantion. Happy hacking...
 
O

olrt

Excuse me but if you read the initial post, there's no mention of such
an environment.
But maybe Vagif could describe his environment... ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top