C# | Visual Basic | Visual C++ |
public CompressionLevel CompressionLevel { get; set; }
Public Property CompressionLevel As CompressionLevel Get Set
public: property CompressionLevel CompressionLevel { CompressionLevel get (); void set (CompressionLevel value); }
When using the DEFLATE compression method, Varying the compression level used on entries can affect the size-vs-speed tradeoff when compression and decompressing data streams or files.
If you do not set this property, the default compression level is used, which normally gives a good balance of compression efficiency and compression speed. In some tests, using BestCompression can double the time it takes to compress, while delivering just a small increase in compression efficiency. This behavior will vary with the type of data you compress. If you are in doubt, just leave this setting alone, and accept the default.
When setting this property on a ZipEntry that is read from an existing zip file, calling ZipFile.Save() will cause the new CompressionLevel to be used on the entry in the newly saved zip file.
Setting this property may have the side effect of modifying the CompressionMethod property. If you set the CompressionLevel to a value other than None, CompressionMethod will be set to Deflate, if it was previously None.
Setting this property has no effect if the CompressionMethod is something other than Deflate or None.