Syntax:
void Environment.Exit(int exitcode);
Parameter(s):
- exitcode: exit code, that we want to return to the operating system. Here, 0 denotes success and non-zero denotes an error.
Return value:
This method does not return any value.
Exception(s):
- System.Security.SecurityException
-
Program:
The source code to demonstrate the use of Exit() method of Environment class is given below. The given program is compiled and executed successfully.
Output: