NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Monitor.TryEnter

Similar to Enter, but will never block, or will only block for a certain amount of time.

Overload List

Version of TryEnter that will block, but only up to a timeout period.

[Visual Basic] Overloads Public Shared Function TryEnter(Object, TimeSpan) As Boolean
[C#] public static bool TryEnter(Object, TimeSpan);
[C++] public: static bool TryEnter(Object*, TimeSpan);
[JScript] public static function TryEnter(Object, TimeSpan) : Boolean;

Version of TryEnter that will block, but only up to a timeout period expressed in milliseconds.

[Visual Basic] Overloads Public Shared Function TryEnter(Object, Integer) As Boolean
[C#] public static bool TryEnter(Object, int);
[C++] public: static bool TryEnter(Object*, int);
[JScript] public static function TryEnter(Object, int) : Boolean;

Attempts to acquire the monitor lock without blocking.

[Visual Basic] Overloads Public Shared Function TryEnter(Object) As Boolean
[C#] public static bool TryEnter(Object);
[C++] public: static bool TryEnter(Object*);
[JScript] public static function TryEnter(Object) : Boolean;

See Also

Monitor Class | Monitor Members | System.Threading Namespace