What is the purpose of Thread.Sleep() method in .NET?Thread.Sleep()
method is used to block or suspend a thread for a specified time limit
defined in milliseconds. This method is available in System.Threading
namespace.
Here is an example: public class
sampleClass { Output of this code will be: Thread sleeps
for next 5 seconds Thread.Sleep method can accept the following as parameters: If
you want to block the thread for a specific time period then specify an
integer value (indicating time in milliseconds) as a parameter of Thread.Sleep
method.
|