Why is the console window closing immediately once displayed my output?

前端 未结 21 2529
死守一世寂寞
死守一世寂寞 2020-11-22 03:45

I\'m studying C# by following the guides in MSDN.

Now, I just tried the Example 1 (here is the link to MSDN), and I\'ve encountered an i

21条回答
  •  Happy的楠姐
    2020-11-22 04:14

    Use Console.Read(); to prevent the program from closing, but make sure you add the Console.Read(); code before return statement, or else it will be a unreachable code .

        Console.Read(); 
        return 0; 
    

    check this Console.Read

提交回复
热议问题