Seeing the console's output in Visual Studio 2010?

后端 未结 10 637
不思量自难忘°
不思量自难忘° 2020-12-12 12:15

I am writing a simple C# program with some outputs (Console.WriteLine(\"...\");). The problem is, each time I run it, I cannot see the program\'s output in the

10条回答
  •  -上瘾入骨i
    2020-12-12 13:17

    In Program.cs, between:

    static int Main(string[] agrs)
    {
    

    and the rest of your code, add:

    #if DEBUG
        int rtn = Main2(args);
        Console.WriteLine("return " + rtn);
        Console.WriteLine("ENTER to continue.");
        Console.Read();
        return rtn;
    }
    
    static int Main2(string[] args)
    {
    #endif
    

提交回复
热议问题