ZipArchive Constructor (Stream^, ZipArchiveMode)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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)

	Stream^ stream,
	ZipArchiveMode mode


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.

Exception Condition

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


stream is null.


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.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top