ZipArchive::CreateEntry Method (String, CompressionLevel)
Creates an empty entry that has the specified entry name and compression level in the zip archive.
Assembly: System.IO.Compression (in System.IO.Compression.dll)
public: ZipArchiveEntry^ CreateEntry( String^ entryName, CompressionLevel compressionLevel )
- Type: System::String
A path, relative to the root of the archive, that specifies the name of the entry to be created.
- Type: System.IO.Compression::CompressionLevel
One of the enumeration values that indicates whether to emphasize speed or compression effectiveness when creating the entry.
Return ValueType: System.IO.Compression::ZipArchiveEntry
An empty entry in the zip archive.
The entryName string should reflect the relative path of the entry you want to create within the zip archive. There is no restriction on the string you provide. However, if it is not formatted as a relative path, the entry is created, but you may get an exception when you extract the contents of the zip archive. If an entry with the specified name already exists in the archive, a second entry is created with the same name.
The value of the LastWriteTime property for the new entry is set to the current time. Set the compressionLevel parameter to Optimal if you want the file to be compressed as much as possible. Set the compressionLevel parameter to Fastest only if you are concerned that the compression operation will not complete quickly enough for your scenario.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.