Stop running the code after 15 seconds

后端 未结 3 1568
北荒
北荒 2020-12-17 04:03

I\'m trying to write something to stop running the code after 15 seconds of running.

I don\'t want While loop or any kind of loop to be used and would l

3条回答
  •  失恋的感觉
    2020-12-17 04:49

    Better you can use below code, which would help to improve in performance.

    System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
    

提交回复
热议问题