Put a Thread to Sleep
Thread.Sleep()
Use this method to put a thread to sleep. It comes with two overloaded version.
The first version takes an integer of miliseconds as an argument and will put the thread to sleep for the number of milliseconds specified.
Usage: Thread.Sleep(5000)
The above statement will cause the current thread to sleep for 5 seconds.
The second version takes a TimeSpan argument
Usage: Thread.Sleep(TimeSpan.FromSeconds(5))
The above statement will cause the current thread to sleep for 5 seconds.
Use this method to put a thread to sleep. It comes with two overloaded version.
The first version takes an integer of miliseconds as an argument and will put the thread to sleep for the number of milliseconds specified.
Usage: Thread.Sleep(5000)
The above statement will cause the current thread to sleep for 5 seconds.
The second version takes a TimeSpan argument
Usage: Thread.Sleep(TimeSpan.FromSeconds(5))
The above statement will cause the current thread to sleep for 5 seconds.

0 Comments:
Post a Comment
<< Home