Attempts, for the specified amount of time, to acquire an exclusive lock on the specified object.
true if the current thread acquires the lock; otherwise, false.
Type Reason ArgumentNullException obj is null. ArgumentOutOfRangeException The value of timeout in milliseconds is negative and is not equal to Timeout.Infinite , or is greater than int.MaxValue .
If successful, this method acquires an exclusive lock on obj.
If the value of timeout converted to milliseconds equals Timeout.Infinite, this method is equivalent to Monitor.Enter(object) (obj). If the value of timeout equals zero, this method is equivalent to Monitor.TryEnter(object) (obj).
Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0