using SaveFileDialog sfd = new() { Filter = "Zip archive|*.zip", Title = "Save zip file", AddExtension = true, DefaultExt = ".zip" };
sfd.ShowDialog();
if (sfd.FileName != "")
{
using var memoryStream = new MemoryStream();
using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true))
{
using var entryStreamFileDB = archive.CreateEntry("file.ext").Open();
using StreamWriter streamWriterDB = new(entryStreamFileDB);
streamWriterDB.Write("some text");
streamWriterDB.Close();
archive.CreateEntryFromFile(@"c:\tmp\some_file_on_disk.ext", "file1.ext");
}
using var fileStream = new FileStream(sfd.FileName, FileMode.Create);
memoryStream.Seek(0, SeekOrigin.Begin);
memoryStream.CopyTo(fileStream);
}