The source code to demonstrate the use of Exit() method of Environment class is given below. The given program is compiled and executed successfully.
using System;
class Sample
{
//Entry point of Program
static public void Main()
{
Console.WriteLine("Before Exit Function");
Environment.Exit(0);
Console.WriteLine("After Exit Function");
}
}
Output:
Before Exit Function
Press any key to continue . . .
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: