So you may or may not have noticed that System.IO.Stream
both has a Close()
method and implements IDisposable
, meaning it has a Dispose()
method, too.
(Note: it’s explicitly implemented, meaning that to access it you’ll need to
use an IDisposable
typed reference in C#, e.g. as in
((IDisposable)myStream).Dispose()
). Stream
is an abstract base class, the most
common derivitive being FileStream.
Without consulting Reflector, ;) can you answer these questions?
Close()
on an open Stream
do?Dispose()
on an open Stream
do?Stream
’s lifecycle?
Close()
and Dispose()
on a single type, or
does that seem natural? Based on your understanding of the pattern, do you
think we should continue to use it, or is there a better one?I have a much lengthier post that I’m writing up regarding an internal design debate we’re currently involved in - responses will help to shape both the post and the debate. :)