/// <summary> /// Writes remaining compressed output data to the output stream /// and closes it. /// </summary> protected override void Dispose(bool disposing) { try { Finish(); } finally { if (state_ != OutputState.Closed) { state_ = OutputState.Closed; if (IsStreamOwner) { BaseOutputStream.Dispose(); } } } }
/// <summary> /// Calls <see cref="Finish"/> and closes the underlying /// stream when <see cref="IsStreamOwner"></see> is true. /// </summary> protected override void Dispose(bool disposing) { if (_is_closed) { return; } _is_closed = true; try { Finish(); } finally { if (IsStreamOwner) { BaseOutputStream.Dispose(); } } }
/// <summary> /// Calls <see cref="Finish"/> and closes the underlying /// stream when <see cref="IsStreamOwner"></see> is true. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected override void Dispose(bool disposing) { if (!isClosed) { isClosed = true; try { Finish(); if (CryptoTransform != null) { CryptoTransform.Dispose(); CryptoTransform = null; } } finally { if (IsStreamOwner) { BaseOutputStream.Dispose(); } } } }