DotNetZip:将ZipFile转换为byte 数组

我正在使用DotNetZip将文件添加到zip存档中,我已从文件系统中读取该文件。 我想将生成的ZipFile转换为byte []数组。 任何帮助将受到高度赞赏。 我的代码如下所示。

public byte[] AddPrjFile(FileStream shapeFileZip, Uri prjLocation) { string prjFileAbsPath = prjLocation.AbsolutePath; using (ZipFile zip = ZipFile.Read(shapFileZip)) { ZipEntry e = zip.AddFile(prjFileAbsPath); e.FileName = zipFile.Name + ".prj"; } return byte_array; } 

您可以简单地使用File.ReadAllBytes静态方法,如:

 return File.ReadAllBytes( shapeFileZip.Name ); 

从您的文件中读取。