Classes that implement IDisposable and have members of IDisposable type should dispose those members in their Dispose() method.

Add a call to m.Dispose() in your Dispose method for each member m that implements IDisposable.

In this example, the class Bad contains two disposable fields stream1 and stream2, but only stream1 is disposed in Bad's Dispose() method.

In the revised example, both stream1 and stream2 are disposed.

  • MSDN: IDisposable Interface.