The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
V19.1
19.1
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

IDisposable Implementation

Makes any class disposable. Generates the Dispose pattern and disposes the specified fields and properties. This feature is identical to the Implement IDisposable code provider.

Selectable items: members included in the dispose pattern. If the IDisposable Implementation action finds no disposable members, it adds the default interface implementation.

Options:

  • Fields can be null

Check this option if the fields or properties for which you are going to define the dispose pattern can potentially have a null value. Use this option to check the members for null before disposing these members.

  • Type can be inheritable

Check this option to create another protected virtual Dispose method. This method accepts a boolean parameter. This option allows you to disable the actual disposing.

  • Type contains unmanaged resources

Check this option to create the ReleaseUnmanagedResources method and the destructor. This destructor calls ReleaseUnmanagedResources and optionally calls Dispose.

Example

The screencast below shows how to use the IDisposable Implementation declare action in Declare Menu.

Dispose