Is AppDomain Finalizing For Unload(), Environment.HasShutdownStarted : Environment : Development C# Examples


C# Examples » Development » Environment »

 

Is AppDomain Finalizing For Unload(), Environment.HasShutdownStarted









    
using  System;
using  System.Runtime.InteropServices;
using  System.Diagnostics;

public  sealed  class  MainClass
{
        static  void  Main()
        {
                  AppDomain  currentDomain  =  AppDomain.CurrentDomain;
                  if(  !currentDomain.IsFinalizingForUnload()  &&!Environment.HasShutdownStarted  )  {
                        Console.WriteLine(  "Failed  to  dispose  of  object!!!"  );
                        Console.WriteLine(  "Object  allocated  at:"  );
                  }
        }
}
    
   
  
   



Output

Failed to dispose of object!!!
Object allocated at:


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Environment