System.Threading.Thread.Sleep(Milliseconds);
//wait 2 seconds
Thread.Sleep(2000);
Task.Delay(2000);
//Both are valid options but Task.Delay() can be used with the async keyword
void Start()
{
StartCoroutine(waiter());
}
IEnumerator waiter()
{
yield return new WaitForSeconds(4);
}
dataGridView1.Rows[x1].Cells[y1].Style.BackColor = System.Drawing.Color.Red;
dataGridView1.Refresh();
System.Threading.Thread.Sleep(1000);