c#,请问如何在根目录下面直接解压一个压缩包(并覆盖源文件)
可以使用 System.IO.Compression 命名空间中的 ZipFile 类解压一个 ZIP 压缩包。
using System.IO.Compression;
// ...
string zipPath = @"C:\example.zip";
string extractPath = @"C:\";
ZipFile.ExtractToDirectory(zipPath, extractPath, true);
这段代码将从 ZIP 压缩包 example.zip 中解压所有文件到根目录 C:\。第三个参数 true 表示将覆盖已存在的文件。
试试看可以不