ComponentOne Zip for .NET 2.0
C1.Zip Assembly / C1.Zip Namespace / C1ZipFile Class / Create Method / Create(Stream) Method
System.IO.Stream that will contain the new zip file.
Example

In This Topic
    Create(Stream) Method
    In This Topic
    Creates a new zip file in a stream.
    Syntax
    Public Overloads Sub Create( _
       ByVal stream As Stream _
    ) 
    public void Create( 
       Stream stream
    )

    Parameters

    stream
    System.IO.Stream that will contain the new zip file.
    Example
    The code below creates a new C1ZipFile on a memory stream, then adds several files to it. Finally, the code gets the zipped data out as an array of bytes, which could be stored in a database for example.
    // create zip on a stream
    MemoryStream msZip = new MemoryStream();
    C1ZipFile zip = new C1ZipFile(msZip, true);
                
    // add some entries to it
    foreach (string f in Directory.GetFiles(@"c:\WINDOWS\Web\Wallpaper"))
    {
      zip.Entries.Add(f);
    }
                
    // get zipped data out as a byte array
    byte[] zipData = msZip.ToArray();
    See Also