true if the current thread holds the lock on obj; otherwise, false.
This method works only for locks that are acquired by using the methods of the System.Threading.Monitor class, or by using the C# lock statement or the Visual Basic SyncLock statement, which are implemented with System.Threading.Monitor.
Use this method with diagnostic tools, such as the System.Diagnostics.Debug.Assert(bool) method and the System.Diagnostics.Contracts.Contract class, to debug locking issues that involve the System.Threading.Monitor class.