O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finalize

When an object is marked for disposal by the GC, it usually calls that object’s Finalize method before it ultimately frees the object memory and destroys the object. The Object class itself has already implemented Finalize, and because all classes are derived from Object, every object in .NET has a Finalize method.

Note

To be accurate, the Finalize method contained in Object is not called within the garbage collection context, because it doesn’t actually perform anything. Instead, the GC algorithm determines whether the object overrides Finalize, and if so, it calls that overridden version.

In its basic implementation, Object.Finalize does... well, absolutely nothing. Basically it just exists. That means that if an object needs to implement ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required