Home »
.Net »
C# Programs
C# - Environment.HasShutdownStarted Property with Example
In this tutorial, we will learn about the C# Environment.HasShutdownStarted property with its definition, usage, syntax, and example.
By Nidhi Last updated : March 30, 2023
Environment.HasShutdownStarted Property
The Environment.HasShutdownStarted property returns a boolean value, true, if CLR is shutting down or not.
Syntax
bool Environment.HasShutdownStarted
Parameter(s)
Return Value
Returnn a 'bool' value.
C# Example of Environment.HasShutdownStarted Property
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 . . .
C# Environment Class Programs »