Wiki

Clone wiki

GoingPostal / AutoDisposeDescendent

Draft!

Implements the dispose pattern on a type descended from a type that implements IDisposable.

  • Overrides protected void Dispose(bool)

Configuration

  • Use the ThrowExceptionTargets property to control when ObjectDisposedException is thrown if members of a disposed object are used.

  • Use the UnhookEvents property to control when events of the type should remove all event handlers.

More configuration

  • Use AutoDisposeMemberAttribute on fields (must test if this works on properties too! issue #?) to control the order members are disposed in or exclude them completely.

  • Use the ThrowObjectDisposedAttribute on methods and properties to locally override the effects of the ThrowExceptionTargets property.

Updated