Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Stream used to require that all cleanup logic went into Close(),
- // which was thought up before we invented IDisposable. However, we
- // need to follow the IDisposable pattern so that users can write
- // sensible subclasses without needing to inspect all their base
- // classes, and without worrying about version brittleness, from a
- // base class switching to the Dispose pattern. We're moving
- // Stream to the Dispose(bool) pattern - that's where all subclasses
- // should put their cleanup starting in V2.
- public virtual void Close()
- {
- /* These are correct, but we'd have to fix PipeStream & NetworkStream very carefully.
- Contract.Ensures(CanRead == false);
- Contract.Ensures(CanWrite == false);
- Contract.Ensures(CanSeek == false);
- */
- Dispose(true);
- GC.SuppressFinalize(this);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement