ComponentOne Zip for .NET
Zip for .NET Task-Based Help / Setting the Level of Compression
In This Topic
    Setting the Level of Compression
    In This Topic

    To minimize the file size of the compressed file, set the compression level on the C1ZStreamWriter's constructor by using the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Dim fn As String = Path.GetTempFileName()
    Dim fs As New FileStream(fn, FileMode.Create)
    Dim compressor As New C1ZStreamWriter(fs, CompressionLevelEnum.BestCompression)
    

    To write code in C#

    C#
    Copy Code
    string fn = Path.GetTempFileName();
    FileStream fs = new FileStream(fn, FileMode.Create);
    C1ZStreamWriter compressor = new C1ZStreamWriter(fs,CompressionLevelEnum.BestCompression);
    

    Note that the code sample above sets the compression level to BestCompression, which has the highest compression time and the lowest speed. Other compression level options on the C1ZStreamWriter's constructor include the following: