c# - Using streamreader on zipped compressed files?

Dynotoe used Ask the Experts™
Hi Gents and Ladies,

I know this is probably a stupid question.  :O

If I wanted to read in lines of an ASCII file that is compressed, either .zip or .rar using stream reader, do I need to de-compress the file first from code?  If the file needs to be de-compressed could someone show me how in Code?

Let me extend my gracious thanks in advance.

Cheers and happy weekend,
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Short answer - yes, you'll need to decompress the data before you can read it.

The last time I dealt with this, the .NET framework didn't have any zip libraries (none that I could find anyway.)

I used SharpZipLib which is an open source zip library which you can use. You can download it here:

Again, since it's open source, you can load up the source and build the .dll yourself. There are also some examples at the link above to show you how to use it. It's pretty easy though - not any more difficult than using a StreamReader anyway.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial