研究了好久,发现好象没有直接将memorystream流保存成ZIP的方法.            using (ZipFile zip = new ZipFile())
            {
                XmlDocument doc = new XmlDocument();
                Stream stm = new MemoryStream();
                doc.Load(@"d:\xml.xml");
                doc.Save(stm);
                ZipEntry e = zip.AddEntry("xmlStm.xml", stm);
                zip.Save("zipFileToCreate.zip");
                stm.Close();
            }我这样写的,打开的的文件是空的,里面没有东西.

解决方案 »

  1.   

                using (ZipFile zip = new ZipFile())
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(@"d:\xml.xml");
                    ZipEntry e = zip.AddEntry("xmlStm.xml", doc.InnerXml, Encoding.Default);
                    zip.Save("zipFileToCreate.zip");
                }
    退而求其次了