Suspends the current thread for a specified time.
[Visual Basic] Overloads Public Shared Sub Sleep( _ ByVal millisecondsTimeout As Integer _ ) [C#] public static void Sleep( int millisecondsTimeout ); [C++] public: static void Sleep( int millisecondsTimeout ); [JScript] public static function Sleep( millisecondsTimeout : int );
Exception Type | Condition |
---|---|
ArgumentException | The timeout value is less than zero. |
ThreadInterruptedException | The thread is interrupted while sleeping. |
SecurityException | The caller does not have the appropriate SecurityPermission. |
If the timeout period is zero, this method forces the thread to give up the remainder of its time slice.
Thread Class | Thread Members | System.Threading Namespace | Thread.Sleep Overload List