protected override void Dispose(bool disposing) { lock (this) { if (disposing) { if (!IsOpen) { // allow double close - usually to be consistent with other closeables return; // already closed } IsOpen = false; if (writer != null) { if (Debugging.AssertsEnabled) { Debugging.Assert(openForWrite); } writer.Dispose(); } else { IOUtils.Dispose(handle); } } } }
public override void Dispose() { lock (this) { if (!IsOpen) { // allow double close - usually to be consistent with other closeables return; // already closed } isOpen = false; if (Writer != null) { Debug.Assert(OpenForWrite); Writer.Dispose(); } else { IOUtils.Close(Handle); } } }