Exclusively for you!! Trial version of Google Apps, Apply Coupon-CNHPGX6T6QRWGV!!
OLAP
Welcome to CodeSpread!

A short note from my experience:

From the name itself you can at least make a guess about the functionality of the GZipStream class(present under: System.IO.Compression). Yes..your guess is absolutely correct. It compresses data. There are various application of this class and is very efficient too. It saves data in the form of compressed files.
GZipStream basically works with bytes. It create a stream of bytes and writes into the respective compressed file. The below code shows how to make use of this class:

using (GZipStream gzStrm = new GZipStream(file, CompressionMode.Compress))
{
gzStrm.Write(b, 0, b.Length);
}

Here ‘b’ is nothing but a byte array or it can be some other Data structure.

‘using’ keyword provide more flexibility with respect to Disposing of no more referenced object/streams. In C#, using keyword is used in 2 different ways:

  • ‘using’ as Directive: mostly used while including the namespace.
  • ‘using’ as part of code: used in block of code to handle dispose of objects(IDisposable object)

‘file’ is the FileStream object which can be created as shown below:

using (FileStream file = new FileStream(fileName, FileMode.Create))
{
//write your code related to file operation.
// Here every time a new file is created which is marked by this: FileMode.Create.
}

Hope this short description about GZipStream shed some light. Please contribute your experience to improve it.

Author: jackie

I am a developer.

Share This Post On

0 Comments

  1. nice superb explaination

    Post a Reply
  2. thanks for the tutorial
    I am having a problem.
    The feature “Create SQL server database” isn’t available , I can’t select it.
    Can you help, please ?

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

More from CodeSpread:

  • VB.Net: Download file from FTP and UnZipVB.Net: Download file from FTP and UnZipExperience: Many application requires data migration tasks to execute on daily basis. To achieve this we generally seek help of SSIS package, if at all we are making use of SQL sever. ...
  • Useful ‘ref’ and ‘out’ parametersUseful ‘ref’ and ‘out’ parameters It took me some time to realize the real potential of ref and out keywords, till the time I experience a condition which could only be simplified by implementing ref and out keyword. Lets st...
  • 20 Dec: Must Read Codes [6-10]20 Dec: Must Read Codes [6-10]We are sharing few must read codes/concepts which are required now and then. Each of these codereads doesn’t require a full length descriptive article so combining them into groups of five. CodeRe...
  • C#: My experience with const keywordC#: My experience with const keywordThere are numerous post on internet about 'what is const keyword in .net' or 'what is the difference between const keyword and read only' and I must say many might have already mugged it up like me...
  • C#: Useful JSON in .NetC#: Useful JSON in .NetWhy JSON? All web applications revolve around large chunk of data and availability of that data to our application is of utmost importance. To do that, we have options like fetch data from databas...
  • C#: Anonymous Type is not anonymous!C#: Anonymous Type is not anonymous!Why Anonymous Type? Anonymous types provide you the ease of having set of properties (Read only) into a single object without knowing the type. It’s the job of compiler to generate the type inform...
  • 19 Dec: Must Read Codes [1-5]19 Dec: Must Read Codes [1-5]We are sharing few must read codes/concepts which are required now and then. Each of these codereads doesn't require a full length descriptive article so combining them into groups of five. CodeRe...
  • C# Code to send a MailC# Code to send a MailWhile working in a project, we always neglect the importance of the code which we have written many times and now end up in copy pasting the code from old projects. Lately, I saw a request in fo...