IDisposable Interface

Make unmanaged resources easily releasable in user-defined types.

Usage

The goal of the IDisposable interface is to provide a uniform way to work with objects that interact with unmanaged resources (like files, database connections, and so on). The IDisposable interface declares a single Dispose() method, in which unmanaged resources must be released:

Get hands-on with 1400+ tech skills courses.