Chapter 14. Using Garbage Collection and Resource Management
After completing this chapter, you will be able to
Manage system resources by using garbage collection.
Write code that runs when an object is finalized by using a destructor.
Release a resource at a known point in time in an exception-safe manner by writing a try/finally statement.
Release a resource at a known point in time in an exception-safe manner by writing a using statement.
Implement the IDisposable interface to support exception-safe disposal in a class.
You have seen in earlier chapters how to create variables and objects, and you should understand how memory is allocated when you create variables and objects. (In case you don’t remember, value types are created on the stack, and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access