GZipStream machine dependence
问题 I'm running into some strange machine/OS dependent GZipStream behavior in .NET 4.0. This is the relevant code: public static string Compress(string input) { using(var ms = new MemoryStream(Encoding.UTF8.GetBytes(input))) using(var os = new MemoryStream()) { using(var gz = new GZipStream(os,CompressionMode.Compress,true)) { ms.CopyTo(gz); } return string.Join("",os.ToArray().Select(b=>b.ToString("X2"))); } } Running Compress("freek") gives me 1F8B08000000000004004B2B4A4DCD06001E33909D05000000