Close() public method

public Close ( ) : void
return void
示例#1
0
 /// <summary>
 ///     Dispose the stream.
 /// </summary>
 /// <remarks>
 ///     <para>
 ///         This may or may not result in a <c>Close()</c> call on the captive
 ///         stream.  See the constructors that have a <c>leaveOpen</c> parameter
 ///         for more information.
 ///     </para>
 ///     <para>
 ///         Application code won't call this code directly.  This method may be
 ///         invoked in two distinct scenarios.  If disposing == true, the method
 ///         has been called directly or indirectly by a user's code, for example
 ///         via the public Dispose() method. In this case, both managed and
 ///         unmanaged resources can be referenced and disposed.  If disposing ==
 ///         false, the method has been called by the runtime from inside the
 ///         object finalizer and this method should not reference other objects;
 ///         in that case only unmanaged resources must be referenced or
 ///         disposed.
 ///     </para>
 /// </remarks>
 /// <param name="disposing">
 ///     true if the Dispose method was invoked by user code.
 /// </param>
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (!_disposed)
         {
             if (disposing && (_baseStream != null))
             {
                 _baseStream.Close();
             }
             _disposed = true;
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
示例#2
0
 /// <summary>
 /// Close the stream.
 /// </summary>
 /// <remarks>
 /// This may or may not close the captive stream.
 /// See the ctor's with leaveOpen parameters for more information.
 /// </remarks>
 public override void Close()
 {
     _baseStream.Close();
 }