如何增加的延迟为一个2或3秒 [英] How to add a delay for a 2 or 3 seconds

查看:126
本文介绍了如何增加的延迟为一个2或3秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能延迟添加到C#程序?

How can I add a delay to a program in C#?

推荐答案

您可以使用 Thread.sleep代码()的功能,例如

You could use Thread.Sleep() function, e.g.

int milliseconds = 2000;
Thread.Sleep(milliseconds)

这停止当前线程的执行2秒钟。

that stops the execution of the current thread for 2 seconds.

无论如何,这不能满足您的需求......到底是什么,你要完成?

Anyway, that could not fit your needs... what exactly are you trying to accomplish ?

这篇关于如何增加的延迟为一个2或3秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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