ComponentOne Zip for .NET
Zip for .NET Task-Based Help / Reading a Zipped File Using a StreamReader
In This Topic
    Reading a Zipped File Using a StreamReader
    In This Topic

    To read a zipped file using a StreamReader, add the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
     ' Open a zip file.
    Dim zip As New C1ZipFile()
    zip.Open("c:\temp\myzipfile.zip")
     ' Open an input stream on any entry.
    Dim ze As C1ZipEntry = zip.Entries("someFile.cs")
    Dim s As Stream = ze.OpenReader()
     ' Open the StreamReader on the stream.
    Dim sr As New StreamReader(s)
     ' Use the StreamReader, then close it.
    

    To write code in C#

    C#
    Copy Code
     // Open a zip file.
    C1ZipFile zip = new C1ZipFile();
    zip.Open(@"c:\temp\myzipfile.zip");
     
    // Open an input stream on any entry.
    C1ZipEntry ze = zip.Entries["someFile.cs"];
    Stream s = ze.OpenReader();
     
    // Open the StreamReader on the stream.
    StreamReader sr = new StreamReader(s);
     
    // Use the StreamReader, then close it.