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

二次信任 提交于 2019-12-02 21:33:11

问题


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:


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.



来源:https://stackoverflow.com/questions/5163094/how-to-zip-and-unzip-byte-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!