C# 压缩文件 的创建

mac2022-06-30  25

using System;using System.IO.Compression;

using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.IO;

namespace ConsoleApplication1{ class Program { static void Main(string[] args) { string path="D:\\20170605.txt" ; using (ZipArchive newFile = ZipFile.Open(path, ZipArchiveMode.Create)) { ZipArchiveEntry entry = newFile.CreateEntry("zipDemo.txt", CompressionLevel.Optimal); using (var entryStream = entry.Open()) { using (StreamWriter sw = new StreamWriter(entryStream)) { sw.Write("123"); } } } } }}

转载于:https://www.cnblogs.com/c-x-a/p/6962758.html

相关资源:c#.net 向压缩包添加文件
最新回复(0)