Simple Finalize : Destructor : Class C# Examples


C# Examples » Class » Destructor »

 

Simple Finalize









    
using  System;

class  MyClass
{
    ~MyClass()
    {
        Console.WriteLine("Finalizing");
    }
}

class  MainClass
{
    static  void  Main(string[]  args)
    {
        MyClass  fc  =  new  MyClass();
        Console.WriteLine("Exiting  main");
    }
}
    
   
  
   



Output

Exiting main
Finalizing


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Destructor