HttpApplicationState.UnLock Método
Definição
Desbloqueia o acesso a uma variável HttpApplicationState para facilitar a sincronização de acesso.Unlocks access to an HttpApplicationState variable to facilitate access synchronization.
public:
void UnLock();
public void UnLock ();
member this.UnLock : unit -> unit
Public Sub UnLock ()
Exemplos
O exemplo a seguir usa o Lock método e o UnLock método para impedir que outras sessões alterem o valor de duas variáveis de aplicativo até que a sessão local tenha sido alterada.The following example uses the Lock method and UnLock method to prevent other sessions from changing the value of two application variables until after the local session has changed them.
Application.Lock();
Application["MyCode"] = 21;
Application["MyCount"] = Convert.ToInt32(Application["MyCount"]) + 1;
Application.UnLock();
Application.Lock()
Application("MyCode") = 21
Application("MyCount") = Convert.ToInt32(Application("MyCount")) + 1
Application.UnLock()
Comentários
A HttpApplicationState classe executa o bloqueio automático e o desbloqueio com AllKeys as Count Propriedades e e Add os Clear métodos,,,, Get GetKey Remove RemoveAt e Set .The HttpApplicationState class performs automatic locking and unlocking with the AllKeys and Count properties and the Add, Clear, Get, GetKey, Remove, RemoveAt and Set methods. No entanto, usar explicitamente os Lock UnLock métodos e quando você tem uma série de operações pode ser mais eficiente.However, explicitly using the Lock and UnLock methods when you have a series of operations may be more efficient.