public byte[] AsByteArray() { // we're gonna close out the zip stream, // but we want the underlying memory stream open so we can get its bytes! ZipStream.IsStreamOwner = false; // leave the memory stream open ZipStream.Finish(); var result = DataStream.ToArray(); ZipStream.Dispose(); return(result); }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (ZipStream != null) { ZipStream.Dispose(); } } } disposed = true; }