CSharp examples for System.IO.Compression:GZip
Compress byte array with GZipStream
using System.Text; using System.IO.Compression; using System.IO;//from www. java2s. c o m using System; public class Main{ public static byte[] Compress(byte[] decompressedData) { if (decompressedData == null) return null; var textStream = new MemoryStream(); var zip = new GZipStream(textStream, CompressionMode.Compress); zip.Write(decompressedData, 0, decompressedData.Length); return textStream.ToArray(); } }