Monday, May 27, 2013

Destructors

Destructors are used to free unused
resources and release memory used by the resources. Destruction of Managed
objects are handled by the Garbage collector in the .Net Framework, we can use
the destructor to release any unmanaged resources like Network connectivity,
database connections etc and release the resources.

The signature of the destructor is similar to a constructor, it shares the same
name of the class, the only difference is that we add a ~ symbol in front of
the method name to denote that this is a destructor.