What is the C# equivalent for the Java System.exit(0)?

CsharpProgrammingServer Side Programming

The C# equivalent for Java System.exit(0) is −

Environment.Exit(exitCode);

The Environment.Exit() method terminates this process and returns an exit code to the operating system.

Above, use exitCode as 0 (zero) to show that the process completed successfully.

Use exitCode as a non-zero number to show an error, for example −

Environment.Exit(1)

Return a value 1 to show that the file you want is not present

Environment.Exit(2)exit

Return a value 2 to indicate that the file is in an incorrect format.

raja
Published on 31-Aug-2018 15:09:17
Advertisements