1 2 3 4 5 6 7 8 9 | private byte[] compress(byte[] unzippedData) { using (MemoryStream compressedStream = new MemoryStream()) using (DeflateStream zip = new DeflateStream(compressedStream, CompressionMode.Compress)) { zip.Write(unzippedData, 0, unzippedData.Length); return compressedStream.ToArray(); } } |