Sams Teach Yourself C# in 24 Hours

Sams Teach Yourself C# in 24 Hours

By James Foxall and Wendy Haro-Chun

Garbage Collection

Although I've talked a lot about objects (you can't talk about anything .NET related without talking about objects), I've avoided discussing the underlying technical details of how .NET creates, manages, and destroys objects. Although you don't need to know the complex minutiae of how .NET works with objects, you do need to understand a few details of how objects are destroyed.

An important thing to remember about garbage collection is that releasing an object by setting it to null or letting an object variable go out of scope doesn't mean the object will be destroyed immediately. The object won't be destroyed until the garbage collector is triggered to go looking for unused objects.

Share ThisShare This

Informit Network