Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ZipArchive Constructor (Stream, ZipArchiveMode, Boolean)

.NET Framework 4.6 and 4.5

Initializes a new instance of the ZipArchive class on the specified stream for the specified mode, and optionally leaves the stream open.

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

	Stream^ stream, 
	ZipArchiveMode mode, 
	bool leaveOpen


Type: System.IO::Stream

The input or output stream.

Type: System.IO.Compression::ZipArchiveMode

One of the enumeration values that indicates whether the zip archive is used to read, create, or update entries.

Type: System::Boolean

true to leave the stream open after the ZipArchive object is disposed; otherwise, false.


The stream is already closed, or the capabilities of the stream do not match the mode.


stream is nullptr.


mode is an invalid value.


The contents of the stream could not be interpreted as a zip archive.


mode is Update and an entry is missing from the archive or is corrupt and cannot be read.


mode is Update and an entry is too large to fit into memory.

If the mode parameter is set to Read, the stream must support reading. If the mode parameter is set to Create, the stream must support writing. If the mode parameter is set to Update, the stream must support reading, writing, and seeking.

.NET Framework

Supported in: 4.6, 4.5

.NET for Windows Phone apps

Supported in: Windows Phone 8.1
© 2015 Microsoft