using (ZipFile zip = new ZipFile()) { zip.AddFile("file1.txt"); zip.AddFile("file2.txt"); zip.Save("example.zip"); }
using (ZipFile zip = ZipFile.Read("example.zip")) { foreach (ZipEntry entry in zip) { entry.Extract("destinationFolder"); } }In this example, we read an existing Zip file using the ZipFile class and extract all files to a folder. Then, we dispose of the ZipFile object after the operation is completed. Overall, the Ionic.Zip library provides a convenient way to work with Zip files in .NET programming language, and the ZipFile class provides useful methods for performing operations on Zip files.