Get or set the exit code of the process in CSharp

Description

The following code shows how to get or set the exit code of the process.

Example


/* w  w  w. ja  v a 2s.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;
    }
}




















Home »
  C# Tutorial »
    Development »




Console
Encoding
Environment
Random