08. Disposing Drawers

  10. Extending Power Inspector No Comments

Power Inspector uses the object pool pattern, reusing existing instances of drawers to reduce the amount of garbage generated.

For this reason, when creating your own drawers, you’ll need to be careful that they are reverted back to their default states when they are disposed in the pool.

Dispose method

When drawers instances are placed in the object pool, the Dispose method (as defined by the IDrawer interface) gets called.
During the execution of this method, the state of the drawer should be completely reverted back to its default state.

NOTE: When you override the Dispose method, remember to always also call base.Dispose!