Check if the current application domain is being unloaded or the common language runtime (CLR) is shutting down in CSharp

Description

The following code shows how to check if the current application domain is being unloaded or the common language runtime (CLR) is shutting down.

Example


// w  w w .  j  a  v  a2  s  .c  o m
using System;

public class Example
{

   public static void Main()
   {
      Console.WriteLine(Environment.HasShutdownStarted);  
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Development »




Console
Encoding
Environment
Random