Compress and decompress a Stream with Compression.DeflateStream
问题 I am trying to compress and decompress a Stream using Compression.DeflateStream. Compressing seems to work correctly since the code below compresses my Stream to a 110 bytes long array. However, reading the decompressed Stream results in an empty string. class Program { static void Main(string[] args) { // Compress a random string value string value = Path.GetRandomFileName(); byte[] compressedBytes; using (var writer = new StreamWriter(new MemoryStream())) { writer.Write(value); writer.Flush