Suspends the current thread for a specified time.
[Visual Basic] Overloads Public Shared Sub Sleep( _ ByVal timeout As TimeSpan _ ) [C#] public static void Sleep( TimeSpan timeout ); [C++] public: static void Sleep( TimeSpan timeout ); [JScript] public static function Sleep( timeout : TimeSpan );
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