The source code to check whether the CLR is shutting down or not using 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()
{
bool isCLRShutDown = false;
isCLRShutDown = Environment.HasShutdownStarted;
if (isCLRShutDown == true)
Console.WriteLine("CLR is shutting down");
else
Console.WriteLine("CLR is not Shutting down");
}
}
Output:
CLR is not shutting down
Press any key to continue . . .
Program:
The source code to check whether the CLR is shutting down or not using Environment class is given below. The given program is compiled and executed successfully.
Output: