c# 如何在按下一个键后显示下一个 WriteLine

c# how to display next WriteLine after pressing a key

基本上在我的代码中,我希望它在用户按下某个键后显示下一行。我以为是 ReadKey,但在我按下一个键后它就关闭了。

例如

WriteLine("Press any key to display invoice...");
ReadKey(); //this part

WriteLine("***************************");
WriteLine("***  Corporation ***");
WriteLine("Customer Invoice \r\n");
WriteLine("SHIP TO: ");

在程序结束前你需要另一个 ReadKey

Console.WriteLine("Press any key to display invoice...");
Console.ReadKey(); //this part

Console.WriteLine("***************************");
Console.WriteLine("***  Corporation ***");
Console.WriteLine("Customer Invoice \r\n");
Console.WriteLine("SHIP TO: ");

// if you dont do this, the program ends and you cant see the other lines
Console.ReadKey();