NET - What is Finalizer? Explain how to implement it

What is Finalizer? Explain how to implement it.

It is a method that is executed when an object is garbage collected. It is similar in function to a destructor. It keeps the memory managed by taking appropriate an action against an object that is released or is no longer in use. It is called up internally on garbage collection.
protected override void Finalize()
{
    try
    {
        //Cleanup all the resources
    }
    finally
    {
        base.Finalize();
    }
}

VB.NET - Difference and similarity between a class and a structure
Difference and similarity between a class and a structure - Both the class and structure are user define types. Both are the template of the object...
VB.NET - What is implicit cast and explicit cast in .Net?
Implicit cast and explicit cast in .Net - Implicit cast allows conversion without any loss of data and it takes place only when there is no possible of loss of data. ....
VB.NET - Imperative and declarative security
Imperative and declarative security - Imperative security is implemented by calling methods of Permission objects in code at run time........
Post your comment