Mega Code Archive

 
Categories / C# / Development Class
 

Terminates this process and gives the underlying operating system the specified exit code

using System; class ExitTest {     public static void Main( )      {         String[ ]   args = Environment.GetCommandLineArgs( );         if( args.Length > 1 )         {             try             {                 int     exitCode = int.Parse( args[1] );                 Console.WriteLine( "it exits with code: 0x{0:X8}.", exitCode );                 Environment.Exit( exitCode );             }catch{ }         }     } }