c# - 如何延迟代码块的运行?
问题描述
这是填充物,因为出于某种原因,堆栈溢出不希望我的帖子完全是代码,即使问题是你所需要的,我真的不知道这里还有什么,所以我现在就发布这个问题。
using System;
public class Program
{
public static void Main()
{
Console.WriteLine("Welcome to this code!");
Console.WriteLine("do nothing for 5 seconds . . .");
//I need to delay the following code
Console.WriteLine("Which game would you like to play?");
}
}
解决方案
您可以使用 Thread.Sleep(5000);
推荐阅读
- r - 在 R 中,如何在 500 次中随机选择三个名称中的两个,并进行平衡选择?
- windows - 如何在 Windows 上保存 Python 2 空闲/shell/命令提示符交互会话?
- javascript - 无法从 javascript 中的 Promise 中追加子数据
- python - 外部“噪声”库只为列表元素生成相同的值
- python - 读取文件,进行一些更改并将结果写回
- python - AutoHotKey 调用 Python 代码——有时有效,有时无效
- node.js - 如何以正确的方式处理 Sequelize 验证错误?
- haskell - 在haskell中的列表列表上进行模式匹配
- bash - 如何修复不正确的 gnu 并行子字符串提取
- swift - 在 Swift 中没有将键值对添加到我的字典中