我想防止 CMD 在运行程序后自动关闭。
代码:
static void Main(string[] args)
{
FileStream textfsw = new FileStream("fileone.txt", FileMode.Append, FileAccess.Write); // CREATING FILE
StreamWriter textsw = new StreamWriter(textfsw);
Console.Write(" Enter your ID: ");
int ID = int.Parse(Console.ReadLine());
Console.Write(" Enter your Name: ");
string Name = Console.ReadLine();
Console.WriteLine(" Thank you! your logged in as" +Name+ +ID);
textsw.Close();
textfsw.Close();
FileStream textfs = new FileStream("fileone.txt", FileMode.Open, FileAccess.Read); // READING A FILE USING ReadAllLines
StreamReader textsr = new StreamReader(textfs);
String[] lines = File.ReadAllLines("fileone.txt");
}
截屏:
我想在运行后显示以下内容并防止 cmd 关闭:
Thank you! your logged in as John Smith 12345
任何答案将不胜感激。
谢谢你。