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.