C# .NET 压缩ZIP时 OOM OutOfMemoryException.
ZipArchiveEntry、ZipEntry、SharpZipLib、ZipOutputStream、OutOfMemoryException.
解决方法:
可以把零散的文件,存到某个文件夹。再调用ZipFile.CreateFromDirectory来压缩。
using System.IO.Compression; Console.WriteLine("Hello, World!"); string startPath = @"E:\迅雷下载\temp1"; string zipPath = @"E:\迅雷下载\temp1.zip"; string extractPath = @"E:\迅雷下载\extract"; Console.WriteLine("开始压缩!"); ZipFile.CreateFromDirectory(startPath, zipPath); Console.WriteLine("开始解压!"); ZipFile.ExtractToDirectory(zipPath, extractPath); Console.WriteLine("解压完成!"); Console.ReadKey();
-
标签:Console,ZIP,C#,压缩,ZipFile,OOM,WriteLine,OutOfMemoryException,NET From: https://www.cnblogs.com/runliuv/p/17309665.html