Example code:
switch(something)
{
case 0:
System.Environment.Exit(0);
case 1:
// blah ...
break;
}
It won't compile because the compiler thinks that execution can return from Exit(). The compiler is obviously wrong.
No tricks. System.Environment.Exit()
is the real one.
Not only is it utterly illogical for System.Environment.Exit()
to return, I traced the code and it eventually calls ExitProcess(exitCode);
which can't return.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…