利用System.IO.Compression操作压缩文件

引用:

using System.IO.Compression;

 

using (FileStream zipToOpen = new FileStream(@"D:\json.zip", FileMode.Open))
            {
                using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
                {

                    ZipArchiveEntry readmeEntry = archive.Entries[0];
                    using(StreamReader reader=new StreamReader(readmeEntry.Open()))
                    {
                        string result= reader.ReadToEnd();
                    }
                   
                }
            }

 参考:https://msdn.microsoft.com/en-us/library/system.io.compression(v=vs.110).aspx

转载于:https://www.cnblogs.com/uptothesky/p/5555841.html

你可能感兴趣的:(利用System.IO.Compression操作压缩文件)