C#5和异步​​定时器定时器

2023-09-03 06:02:03 作者:专属的偏见

有一个新的计时器API的地方,可以让我做到这一点?

Is there a new Timer API somewhere that allows me to do this?

await timer.wait(500);

基本上,睡眠对于x毫秒,然后继续执行函数的其余部分

Basically, to sleep for X ms and then resume execution of the rest of a function

推荐答案

尝试使用

await Task.Delay(500);