how to wait in c#

[ad_1]

c# Sleep
using System.Threading;

static void Main()
{
  //do stuff
  Thread.Sleep(5000) //will sleep for 5 sec
}
how to wait in c#
System.Threading.Thread.Sleep(Milliseconds);
c# wait seconds
//wait 2 seconds
Thread.Sleep(2000);
Task.Delay(2000);

//Both are valid options but Task.Delay() can be used with the async keyword
c# wait seconds
dataGridView1.Rows[x1].Cells[y1].Style.BackColor = System.Drawing.Color.Red;
dataGridView1.Refresh();
System.Threading.Thread.Sleep(1000);

[ad_2]

Please follow and like us:
Content Protection by DMCA.com