永发信息网

C#程序暂停功能

答案:4  悬赏:60  手机版
解决时间 2021-11-07 20:47
  • 提问者网友:沉默的哀伤
  • 2021-11-07 08:04
C#程序暂停功能
最佳答案
  • 五星知识达人网友:底特律间谍
  • 2021-11-07 08:44
你可以使用camnpr提供的方法,就是Console.ReadLine这样的方法
你也可以这样作,
1) Insert System.Runtime.InteropServices to your using clauses.
2) Insert this line in your class (usually in the first few lines)

[DllImport("msvcrt.dll")]
static extern bool system(string str);

3) In that same class, simply write this:
system("pause");

也可以这样作
public static void Pause()
{
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
全部回答
  • 1楼网友:旧脸谱
  • 2021-11-07 10:57
Console.Read();
  • 2楼网友:归鹤鸣
  • 2021-11-07 09:34
可以,用控制台输出;console
  • 3楼网友:夜风逐马
  • 2021-11-07 09:19
是让屏幕定住么?
Console.ReadLine();
把输出语句放在 你要 暂停的地方。
或者可以使用 Thread.Sleep(3000);睡眠 5秒钟,但 using 语句中要加句 using System.Threading;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯