News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

Main Menu

Destructors in C#

Started by thiruvasagamani, Jul 10, 2008, 03:35 PM

Previous topic - Next topic

thiruvasagamani

Destructors

As we all know, 'Destructors' are used to destruct instances of classes. When we are using destructors in C#, we have to keep in mind the following things:

    * A class can only have one destructor.
    * Destructors cannot be inherited or overloaded.
    * Destructors cannot be called. They are invoked automatically.
    * A destructor does not take modifiers or have parameters.

The following is a declaration of a destructor for the class MyClass:

~ MyClass()
{
   // Cleaning up code goes here

}
Thiruvasakamani Karnan