using System; using System.IO; using System.IO.Compression; public class GZipStreamDemo { public static void Main() { byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05 }; using (MemoryStream compressedStream = new MemoryStream()) { using (GZipStream gzipStream = new GZipStream(compressedStream, CompressionMode.Compress)) { // Compress data byte-by-byte foreach (byte b in data) { gzipStream.WriteByte(b); } } // Output compressed data byte[] compressedData = compressedStream.ToArray(); Console.WriteLine(Convert.ToBase64String(compressedData)); } } }In this example, we create a byte array containing some data to be compressed. We then create a MemoryStream to hold the compressed data, and a GZipStream to compress the data byte-by-byte. For each byte in the input data, we call the WriteByte method to compress the byte and write it to the output stream. Finally, we output the compressed data as a Base64-encoded string for demonstration purposes. The package library for the System.IO.Compression namespace is likely to be part of the .NET Framework or .NET Core SDK.