How to zip (and unzip) byte[] in C#?

后端 未结 1 2058
太阳男子
太阳男子 2021-01-26 13:07

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?

相关标签:
1条回答
  • 2021-01-26 13:38

    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.

    0 讨论(0)
提交回复
热议问题