Export (0) Print
Expand All

ZipArchive Constructor (Stream, ZipArchiveMode)

.NET Framework 4.5

Initializes a new instance of the ZipArchive class from the specified stream and with the specified mode.

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

public ZipArchive(
	Stream stream,
	ZipArchiveMode mode
)

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.

ExceptionCondition
ArgumentException

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

ArgumentNullException

stream is null.

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

Supported in: Windows Phone 8.1
Show:
© 2015 Microsoft