Deterministic Resource Cleanup

Dealing with various kinds of resources is an everyday task for most developers. This ranges from local files to remote databases or web services. To make your application well behaved, it’s often important to release resources as soon as they’re not needed anymore. While the .NET runtime has automatic memory management using the garbage collector, other external resources often don’t. In such cases, cooperation from your code might be needed to properly close such resources.

Get C# 4.0 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.