Object Resurrection

With the object resurrection phrase, we describe the scenario in which an object is restored after its reference was removed, although the object was not removed yet from memory. This is an advanced technique, but it is not very useful and Microsoft strongly discourages you from using it in your applications. It is helpful to understand something more about objects’ lifetime. Basically an object being finalized can store a self-reference to a global variable, and this can keep the object alive. In simpler words, a reference to a “died” object is restored when within the Finalize method the current object is assigned (using the Me keyword) to a class level or module level variable. Here’s a small code example for demonstrating ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.