This brings up an interesting design problem, both from my point of
view and from Microsoft's point of view. Let's look at it from MS's
point of view, because I think it's clearer in that case.
If MS publishes a class (such as DataSet) that implements IDisposable,
they're leaving their options open. Perhaps you really have to call
Dispose() on instances of the class, and perhaps you don't. However,
you _should_, because you never know what might happen to the class
implementation in the future. However, from MS's point of view, the
cost is that all users of that class now have to worry about disposal.
How annoying.
Furthermore, if they ever change a class that must be Dispose()d so
that it's now totally managed code and does not need to be Dispose()d,
they can never remove the IDisposable implementation from that class or
they'll break all of the code out there that took pains to properly
dispose of objects of that class. So, they're stuck for all eternity
having the class be IDisposable when it doesn't really need to be.
However, if MS publishes a class that does not implement IDisposable,
then they are, in effect guaranteeing that for all time the class will
be totally managed and will never need to be disposed. If they add
IDisposable later, they're breaking the contract and legacy code may
not properly dispose of instances of that class under the new
Framework. Bummer.
Perhaps this is why documentation for IDisposable discourages us from
making Dispose methods that _have_ to be called in order that an object
be GC'd. For example, this is why it's "bad style" to use Dispose() to
unhook an object from static events, because then if Dispose() is never
called then the object will never be GC'd. (Not that I never abuse
Dispose() in this way... just that I shouldn't
