我想在.NET 4.5(System.IO.Compression)中从一系列字节数组中创建Zip文件。例如,从我使用的API中,我得到一个List<Attachment>
,每个Attachment
都有一个名为Body
的属性,该属性是一个byte[]
。 我该如何遍历该列表并创建包含每个附件的zip文件?
目前我认为我必须将每个附件写入磁盘并从那里创建zip文件。
//This is great if I had the files on disk
ZipFile.CreateFromDirectory(startPath, zipPath);
//How can I create it from a series of byte arrays?