Skip to main content

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.


  • 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.


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