程序不会停止用户输入

use*_*843 0 c#

当我运行我的程序时,它直接运行并且不允许我输入用户输入.

这是我的主要功能

[STAThread]
static void Main()
{
    valueCalculation(validateX(), validateY(), validateZ());
}
Run Code Online (Sandbox Code Playgroud)

这是我的validateX函数

public static String validateX()
{
    Console.WriteLine("Enter your X value: ");
    string x = null;
    do
    {
        x = Console.ReadLine();

        //do stuff
    }
    while(x != null);

    return x;
}
Run Code Online (Sandbox Code Playgroud)

Mar*_*ell 11

存在:

[STAThread]
Run Code Online (Sandbox Code Playgroud)

表明,这曾经是一个WinForms应用程序,这的确会回来nullConsole.ReadLine.将其更改为控制台应用程序.如果这是在VS2013中,右键单击项目名称; Properties => Application =>输出类型.