Is it necessary to lock application state before accessing it ?
Answer / kumar saurabh
Only if you're performing a multistep update and want the update to be treated as an atomic operation. Here's an example:
Application.Lock ();
Application["ItemsSold"] = (int) Application["ItemsSold"] + 1;
Application["ItemsLeft"] = (int) Application["ItemsLeft"] - 1;
Application.UnLock ();
By locking application state before updating it and unlocking it afterwards, you ensure that another request being processed on another thread doesn't read application state at exactly the wrong time and see an inconsistent view of it.
Is This Answer Correct ? | 0 Yes | 0 No |
What’s difference between “optimistic” and “pessimistic” locking?
What are merge modules?
How do sessions work?
I have got less marks in bsc it So how to get interview.tell me
can we transfer data from one page to another page using viewstate if so how?if not y?
What is the difference between sealed vs static class?
Explain advantages of caching?
How to automatically get the latest version of all the asp.net solution items from source safe when opening the solution?
What is ispostback method in asp.net?
What is CSS? What is the advantage os using CSS in ASP.NET Web Applications?
What is .netmodule and how is different from .dll and .exe
when we write the html code with runat = server it works like a server control than why we use the server control?