This blog shows on how to do a compression of a code in C#.
string fileToBeCompressed =
"Document.doc";
string zipFilename =
"Document.zip";
using (FileStream target =
new FileStream(zipFilename,
FileMode.Create, FileAccess.Write))
using (GZipStream alg =
new GZipStream(target, CompressionMode.Compress))
{
byte[] data = File.ReadAllBytes(fileToBeCompressed);
alg.Write(data, 0, data.Length);
alg.Flush();
}