Wiki

Clone wiki

GoingPostal / AutoDispose

Draft!

Implements the dispose pattern on a type.

  • Adds the interface IDisposable.

  • Adds the method public void Dispose()

  • Adds the method 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 or exclude them completely.

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

Updated