public byte[] CreateZipWithStreams(List<StreamInfo> streams) { using var memoryStream = new MemoryStream(); using var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true); foreach (var streamInfo in streams) { streamInfo.Stream.Position = 0; var zipItem = archive.CreateEntry(streamInfo.Name); using var entryStream = zipItem.Open(); streamInfo.Stream.CopyTo(entryStream); } return memoryStream.ToArray(); }
511200cookie-checkC# Create Zip With Streams