Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Delay in application (for debugging)

Tags:

c#

.net

asp.net

I'd like to add a delay between 2 lines of code because I'm testing an updateprogress template. Ideally, the one-liner.

Thanks.

like image 880
frenchie Avatar asked Aug 23 '26 17:08

frenchie


1 Answers

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.

like image 60
Abe Miessler Avatar answered Aug 26 '26 08:08

Abe Miessler



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!