I'd like to add a delay between 2 lines of c开发者_Python百科ode because I'm testing an updateprogress template. Ideally, the one-liner.
Thanks.
Try the Sleep method. Example:
Thread.Sleep(3000); //3 seconds
You will need to add this using directive:
using System.Threading;
to get access to the method.
The parameter you pass it is the number of milliseconds you want to suspend the current thread.
You're looking for the Thread.Sleep method and Preprocessor Directives:
#if DEBUG
Thread.Sleep(1000);
#endif
you're looking for
Thread.Sleep(2000)
You might want to use Thread.Sleep
. It takes the time to sleep in milliseconds
Thread.Sleep(10000);//Waits 10 seconds.
try using Thread.Sleep()
You could put that line in a condition, that will only be 'true', passing that amount of time, using the delay method: Thread.Sleep(time)
System.Threading.Thread.Sleep(int time_ms); //One line, no 'using' :)
精彩评论