Xpode.com        Click here to Print this article.

Difference between Dispose & Finalize

CLR uses the Dispose and Finalize methods for performing garbage collection of runtime objects of .Net applications. CLR has a Garbage Collector(GC) which periodically checks for unused and unreferenced objects in Heap.It call Finalize() method to free the memory used by such objects.

Dispose is another method which is invoked by Garbage Collector to release the memory occupied by an object.Dispose method needs to be explicitly called in code for removing an object from Heap. Dispose method can be invoked only by the classes that IDisposable interface.

In VB.Net, we need to override Finalize as it is does not support destructors.

Contributed by:
Guest user is that user who have done some activity on website without login. Activity contains commenting on any article, uploading an image on website etc.

Resourse address on xpode.com

Click here to go on website