How to create and extract a zip archive by using the ZipFile class in C#

The following code snippet shows how to create a zip file of the folder by using ZipFile Class in c#. In .Net framework 4.5, C# includes a new class in System.IO.Compression.FileSystem. However before 4.5 we have been using GZipStream Class that Provides methods and properties used to compress and decompress streams. Continue reading “How to create and extract a zip archive by using the ZipFile class in C#”

How to check file permission to write in c#

If you need to check that sufficient permissions exist to write to file or not.The following code example shows the use of the FileIOPermission(FileIOPermissionAccess, String) constructor to create a new instance of the FileIOPermission class with the write access to the C:\test.txt file, Write access includes deleting and overwriting files or directories. Continue reading “How to check file permission to write in c#”