LockManager.Lock Method (Object, Int64)

Get a leaf monitor lock for a given object.

Namespace: Microsoft.TeamFoundation.Framework.Server
Assembly: Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)


Public Function Lock ( _
    lockObject As Object, _
    requestId As Long _
) As LockManager.ObjectLockFrame
public LockManager.ObjectLockFrame Lock(
    Object lockObject,
    long requestId
LockManager::ObjectLockFrame Lock(
    Object^ lockObject, 
    long long requestId
member Lock : 
        lockObject:Object * 
        requestId:int64 -> LockManager.ObjectLockFrame
public function Lock(
    lockObject : Object, 
    requestId : long
) : LockManager.ObjectLockFrame


Return Value

Type: Microsoft.TeamFoundation.Framework.Server.LockManager.ObjectLockFrame
The disposable lock frame object to release the lock on dispose.


Use pattern: ... any work before lock is taken using (LockManager.Lock(objectToLock)) { ... some work inside a lock ... (Note that no other lock manager lock can be taken when holding a leaf monitor lock).

} ... any work after lock is released Please do not use outside this "using" pattern. Be very careful - this method returns a disposable struct (that is not a class but a value type).

.NET Framework Security

See Also


LockManager Class

Lock Overload

Microsoft.TeamFoundation.Framework.Server Namespace