Advertisement
Guest User

FileStream.Close()

a guest
Nov 16th, 2011
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1.         // Stream used to require that all cleanup logic went into Close(),
  2.         // which was thought up before we invented IDisposable.  However, we
  3.         // need to follow the IDisposable pattern so that users can write
  4.         // sensible subclasses without needing to inspect all their base
  5.         // classes, and without worrying about version brittleness, from a
  6.         // base class switching to the Dispose pattern.  We're moving
  7.         // Stream to the Dispose(bool) pattern - that's where all subclasses
  8.         // should put their cleanup starting in V2.
  9.         public virtual void Close()
  10.         {
  11.             /* These are correct, but we'd have to fix PipeStream & NetworkStream very carefully.
  12.             Contract.Ensures(CanRead == false);
  13.             Contract.Ensures(CanWrite == false);
  14.             Contract.Ensures(CanSeek == false);
  15.             */
  16.  
  17.             Dispose(true);
  18.             GC.SuppressFinalize(this);
  19.         }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement