How to lock an Application object variable so that multiple page requests cannot change/access its value ?

 Posted by Akiii on 5/15/2012 | Category: ASP.NET Interview questions | Views: 2244 | Points: 40
Answer:

Application.Lock();

Application["Akiii"] = "This is the value that is stored";
Application.UnLock();



If you are doing multi-threaded programming then it is better to lock the global variable otherwise it may cause useless data read/write.



Thanks and Regards
Akiii


| Alert Moderator 

Comments or Responses

Login to post response