I need to change a static property on an object in our web application. The property has a default value that is hard-coded into the object. If I change the static property in my Application_Start does that change stick:
A) Forever (well, until the app is recycled)
B) Until the object is GC’d then re-inialised by the next accessor
C) Depends
Note that the property I’d be setting is just a String
The scope of a static variable is its AppDomain. So no, it won’t get garbage collected – but if the AppDomain is recycled (which can happen a fair amount in ASP.NET) then you’ll end up with a ‘new’ static variable, effectively.