Lock.Scope Struct

Definition

Represents a Lock that might have been entered.

public ref struct Lock.Scope
Inheritance
Lock.Scope

Remarks

This type is intended to be used with the EnterScope method, which returns a Lock.Scope representing the lock that was entered, and with a language construct that automatically disposes the Lock.Scope, such as the C# using keyword. Disposing the Scope exits the lock. Ensure that Dispose is called even in case of exceptions.

For more information, see EnterScope and the Remarks for Lock.

Methods

Dispose()

Exits the lock if the Lock.Scope represents a lock that was entered.

Applies to

Product Versions
.NET 9