C# Program to Check Whether the CLR is Shutting Down or Not Using Environment Class Last Updated : 01 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, environment variable settings information, contents of the call stack information, and time since the last system boot in milliseconds information. By just using some predefined methods we can get the information of the Operating System using the Environment class. Here in this article, we will check whether the CLR(common language runtime) is shutting down or not. So we use the HasShutdownStarted property of the Environment class. This property is used to check whether the CLR is shutting down or the application domain is being unloaded or not. If the CLR is shut down then it will return true. Otherwise, it will return false if the is not CLR is shut down. In the dot net framework, when an application domain is unloaded by CLR, then it executes finalizers on all the objects that contain finalizer function in that application domain. So when the CLR is shut down, then it will execute finalizers threads on all the objects that have the finalizer function. Hence this property returns true when the finalizer thread is started otherwise returns false. Syntax: bool Environment.HasShutdownStarted Return Type: the return type of this property is boolean. Returns true if the CLR is shutting otherwise false. Example: C# // C# program to check whether the CLR is shutdown or not // Using Environment class using System; class GFG { static public void Main() { // Declare a variable bool result; // Determining whether the CLR is shutting down or not // Using HasShutdownStarted property of Environment class result = Environment.HasShutdownStarted; // Displaying result if (result == true) Console.WriteLine("Yes! CLR is shutting down"); else Console.WriteLine("No! CLR is not shutting down"); } } Output: No! CLR is not shutting down Comment More infoAdvertise with us Next Article C# Program to Check Whether a Process is Running in User Interactive Mode or Not Using Environment Class O ojaswilavu8128 Follow Improve Article Tags : C# CSharp-programs Similar Reads C# Program to Check Whether Running Process is 64-bit Process or Not Using Environment Class Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that retrieves command-line arguments information, exit codes information, environme 2 min read C# Program to Check Whether a Process is Running in User Interactive Mode or Not Using Environment Class In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, 2 min read C# Program to Check if Operating System is 64-bit OS or Not Using Environment Class Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that retrieves command-line arguments information, exit codes information, environme 2 min read C# Program to Get the Operating System Version of Computer using Environment Class In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, 2 min read C# Program to Get the Path of System Directory Using Environment Class In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, 2 min read C# Program to Get the Memory Size For OS Page File using Environment Class Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that retrieves command-line arguments information, exit codes information, environme 2 min read Like