Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
大多数编程书籍都会告诉您使用 Console.ReadKey() 来暂停控制台,但有更好的选择吗?
Console.WriteLine("Press any key to continue."); Console.ReadKey();
您实际上并没有告诉我们您希望达到的目标。
如果您希望在用户选择继续之前停止输出,那么您实际上不会比使用Console.ReadKey. 如果你只是想暂停输出一段时间,你可以使用该Thread.Sleep方法,不需要任何人为干预。
Console.ReadKey
Thread.Sleep
Console.ReadLine() 怎么样 :)
system("pause");
做同样的事情