Zip your files using C#.Net…

Assalamualaykum Wr Br…
Today we walk through the code for compressing files in C#.Net 4.5 Framework using Zip.
There are many formats that are available in C#.Net like Deflate, GZip, Zip and many more…We focus mainly on Zip format now in later posts we try to follow other formats inshallah..
Before we start our coding, First add the reference of WindowsBase.dll” in your solution. In case if you couldn’t find it in .Net tab of references window then go to Browse tab and try to find it in the directory as shown:
“C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\”
One more thing we need to do is Import a System.IO.Packaging in your using block.
The following image shows the code:
The output of the above program is shown as:
hope it is helpful to anyone…
Jazakallah khair

Understanding Extension Methods

Assalamualaykum wr br…Today we understand the concept of EXTENSION METHODS.
Extension Methods allows us to add Methods to existing types without recompiling, modifying the existing types. These are the special types of static methods which can be called just like existing methods in types. It uses “this” keyword in the parameter that differs from the other methods.
“this” keyword in the parameter section of the method. It tells the compiler that this is an extension method for the string class, and that’s actually all you need to create an extension method.
The following code demonstrates the implementation of Extension methods shown as:
The corresponding output of the code shown above is:
Hope understood well…we meet soon with lot of stuff..till then Good Bye
Jazakallah khair…