Hello Is there a difference between: 1. Application.Lock(); try { //...code } finally { Application.UnLock(); } pattern and 2. lock(Application) { //...code } ? I read on MSDN (http://support.microsoft.com/default.aspx/kb/271787) that there are some situations when the first pattern blocks the service. Thanks.
Hi: The first pattern is only applied to application state in web applications while second pattern is a rapid and easily implementation of Monitor (enter() and exit()) class valid for many situations. Sorry for my english!!! Regards -- Colabora con el foro: Si la respuesta te es de utilidad marca la pregunta como respondida. Luis Ruiz Pavón MCP - MCTS Blog: http://geeks.ms/blogs/lruiz "nano2k" wrote: > Hello > > Is there a difference between: > > 1. > Application.Lock(); > try { > //...code > } > finally { > Application.UnLock(); > } > > pattern and > 2. > lock(Application) { > //...code > } > > ? > > I read on MSDN (http://support.microsoft.com/default.aspx/kb/271787) > that there are some situations when the first pattern blocks the > service. > > Thanks. > >
On 24 Iul, 14:28, Luis Ruiz Pavón wrote: > Hi: > > The first pattern is only applied to application state in web applications > while second pattern is a rapid and easily implementation of Monitor (enter() > and exit()) class valid for many situations. > > Sorry for my english!!! > > Regards > > -- > Colabora con el foro: Si la respuesta te es de utilidad marca la pregunta > como respondida. > Luis Ruiz Pavón > MCP - MCTS > Blog:http://geeks.ms/blogs/lruiz > > > > "nano2k" wrote: > > Hello > > > Is there a difference between: > > > 1. > > Application.Lock(); > > try { > > //...code > > } > > finally { > > Application.UnLock(); > > } > > > pattern and > > 2. > > lock(Application) { > > //...code > > } > > > ? > > > I read on MSDN (http://support.microsoft.com/default.aspx/kb/271787) > > that there are some situations when the first pattern blocks the > > service. > > > Thanks.- Ascunde citatul - > > - Afi are text în citat - Thanks Luis for your response What is your recommendation. Should we use pattern 1 or pattern 2?