Time delay in For loop in c#

前端 未结 7 1326
伪装坚强ぢ
伪装坚强ぢ 2020-12-06 01:18

how can i use a time delay in a loop after certain rotation? Suppose:

for(int i = 0 ; i<64;i++)
{
........
}

i want 1 sec delay after ea

7条回答
  •  天命终不由人
    2020-12-06 02:11

    Use Thread.Sleep (from System.Threading):

    for(int i = 0 ; i<64;i++)
    {
         if(i % 8 == 0)
            Thread.Sleep(1000);
    }
    

提交回复
热议问题