首页 > 解决方案 > 如何延迟代码块的运行?

问题描述

这是填充物,因为出于某种原因,堆栈溢出不希望我的帖子完全是代码,即使问题是你所需要的,我真的不知道这里还有什么,所以我现在就发布这个问题。

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?");
    }
}

标签: c#

解决方案


您可以使用 Thread.Sleep(5000);


推荐阅读