.NET Framework 4.6 and 4.5
Specifies values that indicate whether a compression operation emphasizes speed or compression size.
Member name Description 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.
Compression operations usually involve a tradeoff between the speed and the effectiveness of compression. You use the
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. CompressionLevel
The following methods of the
, DeflateStream , GZipStream , ZipArchive , and ZipFile classes include a parameter named ZipFileExtensions compressionLevel that lets you specify the compression level: DeflateStream .DeflateStream(Stream, CompressionLevel) DeflateStream .DeflateStream(Stream, CompressionLevel, Boolean) GZipStream .GZipStream(Stream, CompressionLevel) GZipStream .GZipStream(Stream, CompressionLevel, Boolean) ZipArchive .CreateEntry(String, CompressionLevel) ZipFile .CreateFromDirectory(String, String, CompressionLevel, Boolean) ZipFileExtensions .CreateEntryFromFile(ZipArchive, String, String, CompressionLevel)
The following example shows how to set the compression level when creating a zip archive by using the
No code example is currently available or this language may not be supported.
Supported in: 4.6, 4.5
Supported in: Windows Phone 8.1