System.IO.Compression.CompressionLevel Enumeration

Specifies values that indicate whether a compression operation emphasizes speed or compression size.

Syntax

public enum CompressionLevel

Remarks

Compression operations usually involve a tradeoff between the speed and the effectiveness of compression. You use the System.IO.Compression.CompressionLevel enumeration to indicate which factor is more important in your development scenario: the time to complete the compression operation or the size of the compressed file. These values do not correspond to specific compression levels; the object that implements compression determines how to handle them.

The following methods of the System.IO.Compression.DeflateStream, System.IO.Compression.GZipStream, System.IO.Compression.ZipArchive, System.IO.Compression.ZipFile, and System.IO.Compression.ZipFileExtensions classes include a parameter named compressionLevel that lets you specify the compression level:

Members

Member NameDescription
Fastest

The compression operation should complete as quickly as possible, even if the resulting file is not optimally compressed.

NoCompression

No compression should be performed on the file.

Optimal

The compression operation should be optimally compressed, even if the operation takes a longer time to complete.

Requirements

Namespace: System.IO.Compression
Assembly: System (in System.dll)
Assembly Versions: 4.0.0.0