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

前端 未结 21 2251
死守一世寂寞
死守一世寂寞 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条回答
  •  你的背包
    2020-11-22 04:04

    The program is closing as soon as it's execution is complete. In this case when you return 0;. This is expected functionality. If you want to see the output then either run it in a terminal manually or set a wait at the end of the program so that it will stay open for a few seconds ( using the threading library ).

提交回复
热议问题