public void Dispose() { long totalLength = GetTotalLength(); if (LengthChanging != null) LengthChanging(this, EventArgs.Empty); DisposeViews(); NativeStream.SetLength(totalLength); if (OwnsStream) NativeStream.Dispose(); }