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)

public:
ZipArchive(
	Stream^ stream, 
	ZipArchiveMode mode, 
	bool leaveOpen
)

Parameters

stream
Type: System.IO::Stream

The input or output stream.

mode
Type: System.IO.Compression::ZipArchiveMode

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

leaveOpen
Type: System::Boolean

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

ExceptionCondition
ArgumentException

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

ArgumentNullException

stream is nullptr.

ArgumentOutOfRangeException

mode is an invalid value.

InvalidDataException

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

-or-

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

-or-

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
Show:
© 2015 Microsoft