如何让我的 C# 程序休眠 50 毫秒? [英] How do I get my C# program to sleep for 50 msec?
本文介绍了如何让我的 C# 程序休眠 50 毫秒?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何让我的 C# 程序休眠 50 毫秒?
How do I get my C# program to sleep for 50 milliseconds?
这似乎是一个简单的问题,但我有一个暂时的脑力衰竭时刻!
This might seem an easy question, but I'm having a temporary brain failure moment!
推荐答案
System.Threading.Thread.Sleep(50);
但请记住,在主 GUI 线程中执行此操作会阻止您的 GUI 更新(它会感觉缓慢")
Remember though, that doing this in the main GUI thread will block your GUI from updating (it will feel "sluggish")
只需删除 ;
即可使其也适用于 VB.net.
Just remove the ;
to make it work for VB.net as well.
这篇关于如何让我的 C# 程序休眠 50 毫秒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文