O'Reilly logo

Applied Microsoft® .NET Framework Programming by Jeffrey Richter

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

Weak References

When a root points to an object, the object can’t be collected because the application’s code can reach the object. When a root points to an object, a strong reference to the object is said to exist. However, the garbage collector also supports weak references. Weak references allow the garbage collector to collect the object but also allow the application to access the object. It all comes down to timing.

If only weak references to an object exist and the garbage collector runs, the object is collected, and when the application later attempts to access the object, the access will fail. On the other hand, to access a weakly referenced object, the application must obtain a strong reference to the object. If the application obtains ...

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