Monitor.IsEntered Method (Object)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Determines whether the current thread holds the lock on the specified object.

Namespace:   System.Threading
Assembly:  mscorlib (in mscorlib.dll)

Public Shared Function IsEntered (
	obj As Object
) As Boolean


Type: System.Object

The object to test.

Return Value

Type: System.Boolean

true if the current thread holds the lock on obj; otherwise, false.

Exception Condition

obj is null.

This method works only for locks that are acquired by using the methods of the Monitor class, or by using the C# lock statement or the Visual Basic SyncLock statement, which are implemented with Monitor.

Use this method with diagnostic tools, such as the Assert method and the Contract class, to debug locking issues that involve the Monitorclass.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top