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.

As I discussed in previous hours, setting an object variable to null or letting it go out of scope destroys the object. However, as I mentioned in Hour 17, “Designing Objects Using Classes,” this isn't the whole story. The .NET platform uses a garbage ...

Get Sams Teach Yourself C#™ in 24 Hours 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.