How can i put a delay with C#? How can i put a delay with C#? windows windows

How can i put a delay with C#?


Thread.Sleep(100); will do the trick. This can be found in the System.Threading namespace.


You can use the Thread.Sleep() method to suspend the current thread for X milliseconds:

// Sleep for five secondsSystem.Threading.Thread.Sleep(5000);


To sleep for 100ms use Thread.Sleep

While(true){      send("OK");  Thread.Sleep(100);}