Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thread.Sleep c#.NET

I want to put a thread to sleep, and I don't have a sleep method.

I have using System.Threading.

In my code i write :

Thread t = new Thread(StartPointMethod);
t.

In the Methods list there is no Sleep....

What could be the problem?

like image 217
N.D Avatar asked Oct 18 '25 03:10

N.D


2 Answers

This code for sleep current thread for 20 second.

System.Threading.Thread.Sleep(20000);
like image 65
Saleh Avatar answered Oct 20 '25 18:10

Saleh


Use this method in any method in your new thread that you want to sleep.

System.Threading.Thread.Sleep(500);
like image 21
Farzin Zaker Avatar answered Oct 20 '25 16:10

Farzin Zaker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!