C# Environment ExitCode
Description
Environment ExitCode
gets or sets the exit code of the
process.
Syntax
Environment.ExitCode
has the following syntax.
public static int ExitCode { get; set; }
Example
The following is a simple app named Double.exe that doubles an integer value passed to it as a command-line argument.
/*ww w .ja v a 2 s .c om*/
using System;
public class Example
{
private const int ERROR_BAD_ARGUMENTS = 0xA0;
private const int ERROR_ARITHMETIC_OVERFLOW = 0x216;
private const int ERROR_INVALID_COMMAND_LINE = 0x667;
public static void Main()
{
Environment.ExitCode = ERROR_INVALID_COMMAND_LINE;
//Environment.ExitCode = ERROR_ARITHMETIC_OVERFLOW;
//Environment.ExitCode = ERROR_BAD_ARGUMENTS;
}
}
The code above generates the following result.