There are many scenarios in which we need to deal with zip and unzip. This will decrease our manual work of zipping and unzipping. Using this, we can make automated processes for the same. .NET has vast improvement in the using System.IO.Compression; namespace. This includes below types to compress and decompress files and streams.
First we see for zipping a folder including subfolder or files. Here, we just call the CreateFromDirectory() method of ZipFile.We can also use CreateDirectory(), GetDirectory() methods of ZipArchive class and Open() and Delete() methods of ZipArchiveEntry class
Explanation: Note that here we simply provide two parameters to method. First is, what to zip and second is where to put it. By default method considers that level of compression is optimal, we are not providing that here. Other levels are fastest and none.