[英]Microsoft Visual Studio Debug Console
Whenever I run my code it is stuck in debug mode.每当我运行我的代码时,它都会陷入调试模式。 I have looked for the "enable visual studio" check box other forums have suggested but there isn't one in debug> options.
我已经寻找其他论坛建议的“启用视觉工作室”复选框,但调试>选项中没有。 I have not changed any settings so I'm not sure why it's stuck doing this now.
我没有更改任何设置,所以我不确定为什么它现在卡住了。
This is the message that shows up in the command prompt这是命令提示符中显示的消息
C:\Users\bob\Desktop\csharp\WhileIterationStatement\bin\Debug\netcoreapp3.1\WhileIterationStatement.exe (process 15644) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
additional info, I have a while iteration statement, Console.WriteLine("Choose an option:");附加信息,我有一个 while 迭代语句,Console.WriteLine("Choose an option:"); Console.WriteLine("1) Option 1");
Console.WriteLine("1) 选项 1"); Console.WriteLine("2) Option 2");
Console.WriteLine("2) 选项 2"); Console.WriteLine("3) Exit");
Console.WriteLine("3) 退出"); string result = Console.ReadLine();
字符串结果 = Console.ReadLine(); if (result == "1") so on and so forth it should ask for user input, but it just does nothing.
if (result == "1") 等等它应该要求用户输入,但它什么也不做。 –
–
If you want to ask for user input, you can refer to the following code:如果要询问用户输入,可以参考以下代码:
static void Main(string[] args)
{
Console.WriteLine("Choose an option:");
Console.WriteLine("1) Option 1");
Console.WriteLine("2) Option 2");
Console.WriteLine("3) Exit");
while (true)
{
string keyChoice = Console.ReadLine();
switch (keyChoice)
{
case "0":
Console.Clear();
Console.WriteLine("Choose an option:");
Console.WriteLine("1) Option 1");
Console.WriteLine("2) Option 2");
Console.WriteLine("3) Exit");
continue;
case "1":
//To do
Console.Clear();
Console.WriteLine("Choose Option 1");
Console.WriteLine("Pass '0' To Return To The Main Menu");
continue;
case "2":
//To do
Console.Clear();
Console.WriteLine("Choose Option 2");
Console.WriteLine("Pass '0' To Return To The Main Menu");
continue;
case "3":
return;
}
}
}
Here is a screenshot of my test, I hope it is useful for you.这是我的测试截图,希望对你有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.