C#5和异步​​定时器 [英] C# 5 and async timers

查看:106
本文介绍了C#5和异步​​定时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个新的计时器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);

这篇关于C#5和异步​​定时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆