System.IO.Compression 未创建 Zip 文件

Zip files not getting created by System.IO.Compression

System.IO.Compression 程序集可以创建某些特定文件(如 .txt、.bak)的 zip 文件,还是只创建目录的 zip 文件?我无法创建特定文件的 zip 文件,而只能创建目录的 zip 文件

您可以创建 ZipArchive object and then add individual files (including just one) by creating ZipArchiveEntry 个对象。

为方便起见,ZipFileExtensions class has an CreateEntryFromFile 方法。