0

How can I zip (and unzip) a byte array in C#?

Is it efficient to use zip/unzip on byte arrays with less than 100 elements?

jM2.me
  • 3,839
  • 12
  • 44
  • 58

1 Answers1

5

DotNetZip is the library I have used to handle zip/unzip in .NET . If you don't care about the format and if you are just looking for a compression technique, you could look into GZipStream class that's built into .Net framework. Here's an example. .

Compression is one thing that's highly subjective based on the content. You could do a few tests with your elements to get get an average compression ratio and then you can decide whether or not it's worth the overhead.

Cheeso
  • 189,189
  • 101
  • 473
  • 713
Bala R
  • 107,317
  • 23
  • 199
  • 210