String sourcefilename = FILETOBECOMPRESSED; Filestream sourcefile = File.OpenRead(sourcefilename); Filestream destinationfile = File.Create(outputfilename); GZipStream compressionstream = new GZipStream(destinationfile, CompressionMode.Compress); int sourcebyte = sourcefile.ReadByte(); while(sourcebyte != -1) { compressionstream.WriteByte((byte)sourcebyte); sourcebyte = sourcefile.ReadByte(); } //csharp/7605