-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Troy Willmot edited this page May 20, 2017
·
5 revisions
Welcome to the Yort.Trashy wiki!
What would you like to do today?
- Implement the dispose pattern correctly, including "thread-safety" and "idempotency".
- Via inheritance (easiest).
- Via composition (more work, allows other base classes).
- Implement the IIsDisposable interface for components that want to expose their disposed status.
- Dispose objects easily with TryDispose, i.e ignore nulls, avoid manually casting to IDisposable, optionally suppress errors during disposal.
- Dispose collections of items with TryDispose.
- Dispose multiple objects with DisposeAll.
- Inherit from and use ReferenceCountedDisposableBase to prevent being disposed too early.
- Track and log disposable object instances, including those that are not properly (explicitly) disposed.