Difference between Environment.Exit and simple return 2 from Main

后端 未结 3 1678
刺人心
刺人心 2021-02-12 17:31

From outside of the application, is there any difference between

...
Environment.Exit(2)

and

static int Main()
{
    ...
    re         


        
3条回答
  •  隐瞒了意图╮
    2021-02-12 18:16

    If you are doing a Unit Test and calling Main

    Program.Main(args);
    

    then Environment.exit will always reflect a failure. Where as using return will work as expect.

提交回复
热议问题