How to Zip and Unzip File in C#

Hi Programmers. welcome to new article of ozanecare. this article i am going to write contents to zip and unzip files using
c#.net. The First we need to add namespace System.IO.Compression. the ZipFile class definition has written in System.IO.Compression namespace. Taking three string type variable, first for filePath second to zip file and third to extract file.using ZipFile class and with dot operator calling CreateFromDirectory. the CreateFromDirectory has two parameter first to supply file/folder next to zipping file
and ZipFile class and with dot operator calling ExtractToDirectory to unzip file. see below image.

Happy Coding…Thanks.

Post Author: adama