I\'m working on ASP.NET MVC3 with C#. I want to add some delay between each iteration of for loop.
for(int i=0; i<5; i++)
{
//some code
//add dela
The simplest way is to put the current thread to sleep.
System.Threading.Thread.Sleep (200);
Remember though, that threads in a web application are very precious resources, and putting one to sleep still keeps the thread busy.
There is usually no good reason to do this in a web application.
Whatever problem needs you to do this, can be solved in a better manner.