Illustrates a destructor : Destructor : Class C# Examples


C# Examples » Class » Destructor »

 

Illustrates a destructor









    
public  class  Car
{
    ~Car()
    {
        System.Console.WriteLine("In  ~Car()  destructor");
    }

}

class  MainClass
{

    public  static  void  Main()
    {
        Car  myCar  =  new  Car();

        System.Console.WriteLine("At  the  end  of  Main()");
    }

}
    
   
  
   



Output

At the end of Main()
In ~Car() destructor


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Destructor