Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 16 additions & 16 deletions xml/System.IO.Compression/DeflateStream.xml

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions xml/System.IO.Compression/GZipStream.xml

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions xml/System.IO.Compression/ZipArchive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
## Remarks
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 path and name already exists in the archive, a second entry is created with the same path and name.

The value of the <xref:System.IO.Compression.ZipArchiveEntry.LastWriteTime> property for the new entry is set to the current time. The entry is compressed using the default compression level of the underlying compression algorithm. If you want to specify a different compression level, use the <xref:System.IO.Compression.ZipArchive.CreateEntry%2A> method.
The value of the <xref:System.IO.Compression.ZipArchiveEntry.LastWriteTime> property for the new entry is set to the current time. The entry is compressed using the default compression level of the underlying compression algorithm. If you want to specify a different compression level, use the <xref:System.IO.Compression.ZipArchive.CreateEntry*> method.

## Examples
The following example shows how to create an entry and write to it by using a stream.
Expand Down Expand Up @@ -640,11 +640,11 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
<format type="text/markdown"><![CDATA[

## Remarks
This method finishes writing the archive and releases all resources used by the <xref:System.IO.Compression.ZipArchive> object. Unless you construct the object by using the <xref:System.IO.Compression.ZipArchive.%23ctor%28System.IO.Stream%2CSystem.IO.Compression.ZipArchiveMode%2CSystem.Boolean%29> constructor overload and set its `leaveOpen` parameter to `true`, all underlying streams are closed and no longer available for subsequent write operations.
This method finishes writing the archive and releases all resources used by the <xref:System.IO.Compression.ZipArchive> object. Unless you construct the object by using the <xref:System.IO.Compression.ZipArchive.%23ctor(System.IO.Stream,System.IO.Compression.ZipArchiveMode,System.Boolean)> constructor overload and set its `leaveOpen` parameter to `true`, all underlying streams are closed and no longer available for subsequent write operations.

When you are finished using this instance of <xref:System.IO.Compression.ZipArchive>, call <xref:System.IO.Compression.ZipArchive.Dispose> to release all resources used by this instance. You should eliminate further references to this <xref:System.IO.Compression.ZipArchive> instance so that the garbage collector can reclaim the memory of the instance instead of keeping it alive for finalization.

<xref:System.IO.Compression.ZipArchive.Dispose> calls the <xref:System.IO.Compression.ZipArchive.Dispose%28System.Boolean%29> method, which contains the code to release managed and unmanaged resources. For more information, see [Implementing a Dispose method](/dotnet/standard/garbage-collection/implementing-dispose).
<xref:System.IO.Compression.ZipArchive.Dispose> calls the <xref:System.IO.Compression.ZipArchive.Dispose(System.Boolean)> method, which contains the code to release managed and unmanaged resources. For more information, see [Implementing a Dispose method](/dotnet/standard/garbage-collection/implementing-dispose).

]]></format>
</remarks>
Expand Down Expand Up @@ -692,15 +692,15 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
<format type="text/markdown"><![CDATA[

## Remarks
If `disposing` is set to `true`, all underlying streams are closed and no longer available for subsequent write operations, unless you construct the object by using the <xref:System.IO.Compression.ZipArchive.%23ctor%28System.IO.Stream%2CSystem.IO.Compression.ZipArchiveMode%2CSystem.Boolean%29> constructor overload and set its `leaveOpen` parameter to `true`.
If `disposing` is set to `true`, all underlying streams are closed and no longer available for subsequent write operations, unless you construct the object by using the <xref:System.IO.Compression.ZipArchive.%23ctor(System.IO.Stream,System.IO.Compression.ZipArchiveMode,System.Boolean)> constructor overload and set its `leaveOpen` parameter to `true`.

This method is called only by the public <xref:System.IO.Compression.ZipArchive.Dispose> and <xref:System.Object.Finalize> methods; do not call this method directly.

When you implement the dispose pattern, the Boolean parameter of the <xref:System.IO.Compression.ZipArchive.Dispose%28System.Boolean%29> method should be used as follows:
When you implement the dispose pattern, the Boolean parameter of the <xref:System.IO.Compression.ZipArchive.Dispose(System.Boolean)> method should be used as follows:

- The <xref:System.IO.Compression.ZipArchive.Dispose> method of the current object should call <xref:System.IO.Compression.ZipArchive.Dispose%28System.Boolean%29> with the Boolean parameter set to `true` to release both managed and unmanaged resources.
- The <xref:System.IO.Compression.ZipArchive.Dispose> method of the current object should call <xref:System.IO.Compression.ZipArchive.Dispose(System.Boolean)> with the Boolean parameter set to `true` to release both managed and unmanaged resources.

- The <xref:System.Object.Finalize> method of the current object should call <xref:System.IO.Compression.ZipArchive.Dispose%28System.Boolean%29> with the Boolean parameter set to `false` to release only unmanaged resources.
- The <xref:System.Object.Finalize> method of the current object should call <xref:System.IO.Compression.ZipArchive.Dispose(System.Boolean)> with the Boolean parameter set to `false` to release only unmanaged resources.

For more information, see [Implementing a Dispose method](/dotnet/standard/garbage-collection/implementing-dispose).

Expand Down Expand Up @@ -801,7 +801,7 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
<format type="text/markdown"><![CDATA[

## Remarks
Use the <xref:System.IO.Compression.ZipArchive.Entries> property to retrieve the entire collection of entries. Use the <xref:System.IO.Compression.ZipArchive.GetEntry%2A> method to retrieve a single entry by name.
Use the <xref:System.IO.Compression.ZipArchive.Entries> property to retrieve the entire collection of entries. Use the <xref:System.IO.Compression.ZipArchive.GetEntry*> method to retrieve a single entry by name.

## Examples
The following example shows how to open a zip archive and iterate through the collection of entries.
Expand Down Expand Up @@ -863,7 +863,7 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
If multiple entries that have the specified name exist in the archive, the first one is returned. The name of the entry is compared to `entryName` using ordinal comparison.

## Examples
The following example shows how to use the <xref:System.IO.Compression.ZipArchive.GetEntry%2A> method to retrieve an entry.
The following example shows how to use the <xref:System.IO.Compression.ZipArchive.GetEntry*> method to retrieve an entry.

:::code language="csharp" source="~/snippets/csharp/System.IO.Compression/ZipArchive/GetEntry/program2.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO.Compression/ZipArchive/GetEntry/program2.fs" id="Snippet2":::
Expand Down Expand Up @@ -918,7 +918,7 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
<format type="text/markdown"><![CDATA[

## Remarks
You specify a value for the <xref:System.IO.Compression.ZipArchive> property when you create an instance of the <xref:System.IO.Compression.ZipArchive> class. Use the <xref:System.IO.Compression.ZipArchive.%23ctor%28System.IO.Stream%2CSystem.IO.Compression.ZipArchiveMode%29> or <xref:System.IO.Compression.ZipArchive.%23ctor%28System.IO.Stream%2CSystem.IO.Compression.ZipArchiveMode%2CSystem.Boolean%29> constructor to provide a value for the <xref:System.IO.Compression.ZipArchive.Mode> property.
You specify a value for the <xref:System.IO.Compression.ZipArchive> property when you create an instance of the <xref:System.IO.Compression.ZipArchive> class. Use the <xref:System.IO.Compression.ZipArchive.%23ctor(System.IO.Stream,System.IO.Compression.ZipArchiveMode)> or <xref:System.IO.Compression.ZipArchive.%23ctor(System.IO.Stream,System.IO.Compression.ZipArchiveMode,System.Boolean)> constructor to provide a value for the <xref:System.IO.Compression.ZipArchive.Mode> property.

]]></format>
</remarks>
Expand Down
6 changes: 3 additions & 3 deletions xml/System.IO.Compression/ZipArchiveEntry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
This property cannot be retrieved when the mode is set to <xref:System.IO.Compression.ZipArchiveMode.Create>, or the mode is set to <xref:System.IO.Compression.ZipArchiveMode.Update> and the entry has been opened.

## Examples
The following example shows how to retrieve entries in a zip archive, and evaluate the properties of the entries. It uses the <xref:System.IO.Compression.ZipArchiveEntry.Name> property to display the name of the entry, and the <xref:System.IO.Compression.ZipArchiveEntry.Length%2A> and <xref:System.IO.Compression.ZipArchiveEntry.CompressedLength%2A> properties to calculate how much the file was compressed.
The following example shows how to retrieve entries in a zip archive, and evaluate the properties of the entries. It uses the <xref:System.IO.Compression.ZipArchiveEntry.Name> property to display the name of the entry, and the <xref:System.IO.Compression.ZipArchiveEntry.Length*> and <xref:System.IO.Compression.ZipArchiveEntry.CompressedLength*> properties to calculate how much the file was compressed.

:::code language="csharp" source="~/snippets/csharp/System.IO.Compression/ZipArchive/GetEntry/program1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO.Compression/ZipArchive/GetEntry/program1.vb" id="Snippet1":::
Expand Down Expand Up @@ -488,7 +488,7 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
This property cannot be retrieved when the mode is set to <xref:System.IO.Compression.ZipArchiveMode.Create>, or the mode is set to <xref:System.IO.Compression.ZipArchiveMode.Update> and the entry has been opened.

## Examples
The following example shows how to retrieve entries from a zip archive, and evaluate the properties of the entries. It uses the <xref:System.IO.Compression.ZipArchiveEntry.Name> property to display the name of the entry, and the <xref:System.IO.Compression.ZipArchiveEntry.Length%2A> and <xref:System.IO.Compression.ZipArchiveEntry.CompressedLength%2A> properties to calculate how much the file was compressed.
The following example shows how to retrieve entries from a zip archive, and evaluate the properties of the entries. It uses the <xref:System.IO.Compression.ZipArchiveEntry.Name> property to display the name of the entry, and the <xref:System.IO.Compression.ZipArchiveEntry.Length*> and <xref:System.IO.Compression.ZipArchiveEntry.CompressedLength*> properties to calculate how much the file was compressed.

:::code language="csharp" source="~/snippets/csharp/System.IO.Compression/ZipArchive/GetEntry/program1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO.Compression/ZipArchive/GetEntry/program1.vb" id="Snippet1":::
Expand Down Expand Up @@ -583,7 +583,7 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
You use this method to access the stream for an entry in a zip archive. After retrieving the stream, you can read from or write to the stream. When you write to the stream, the modifications you make to the entry will appear in the zip archive.

## Examples
The following example shows how to create a new entry, open it with the <xref:System.IO.Compression.ZipArchiveEntry.Open%2A> method, and write to the stream.
The following example shows how to create a new entry, open it with the <xref:System.IO.Compression.ZipArchiveEntry.Open*> method, and write to the stream.

:::code language="csharp" source="~/snippets/csharp/System.IO.Compression/ZipArchive/CreateEntry/program1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO.Compression/ZipArchive/CreateEntry/program1.vb" id="Snippet1":::
Expand Down
6 changes: 3 additions & 3 deletions xml/System.IO.Compression/ZipFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ An I/O error occurred while opening a file to be archived.</exception>
<format type="text/markdown"><![CDATA[

## Remarks
The directory structure from the file system is preserved in the archive. If the directory is empty, an empty archive is created. This method overload does not include the base directory in the archive and does not allow you to specify a compression level. If you want to include the base directory or specify a compression level, call the <xref:System.IO.Compression.ZipFile.CreateFromDirectory%28System.String%2CSystem.String%2CSystem.IO.Compression.CompressionLevel%2CSystem.Boolean%29> method overload.
The directory structure from the file system is preserved in the archive. If the directory is empty, an empty archive is created. This method overload does not include the base directory in the archive and does not allow you to specify a compression level. If you want to include the base directory or specify a compression level, call the <xref:System.IO.Compression.ZipFile.CreateFromDirectory(System.String,System.String,System.IO.Compression.CompressionLevel,System.Boolean)> method overload.

If the archive already exists, an <xref:System.IO.IOException> exception is thrown. If an entry with the specified name already exists in the archive, a second entry is created with an identical name.

Expand Down Expand Up @@ -2509,7 +2509,7 @@ An archive entry has been compressed using a compression method that isn't suppo
<format type="text/markdown"><![CDATA[

## Remarks
When you set the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.Read>, the archive is opened with <xref:System.IO.FileMode.Open> from the <xref:System.IO.FileMode> enumeration as the file mode value. If the archive does not exist, a <xref:System.IO.FileNotFoundException> exception is thrown. Setting the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.Read> is equivalent to calling the <xref:System.IO.Compression.ZipFile.OpenRead%2A> method.
When you set the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.Read>, the archive is opened with <xref:System.IO.FileMode.Open> from the <xref:System.IO.FileMode> enumeration as the file mode value. If the archive does not exist, a <xref:System.IO.FileNotFoundException> exception is thrown. Setting the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.Read> is equivalent to calling the <xref:System.IO.Compression.ZipFile.OpenRead*> method.

When you set the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.Create>, the archive is opened with <xref:System.IO.FileMode.CreateNew?displayProperty=nameWithType> as the file mode value. If the archive already exists, an <xref:System.IO.IOException> is thrown.

Expand Down Expand Up @@ -2899,7 +2899,7 @@ An unspecified I/O error occurred while opening the file.</exception>
<remarks>
<format type="text/markdown"><![CDATA[

This method is equivalent to calling the <xref:System.IO.Compression.ZipFile.Open%2A> method and setting the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.Read>. The archive is opened with <xref:System.IO.FileMode.Open?displayProperty=nameWithType> as the file mode value. If the archive does not exist, a <xref:System.IO.FileNotFoundException> exception is thrown.
This method is equivalent to calling the <xref:System.IO.Compression.ZipFile.Open*> method and setting the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.Read>. The archive is opened with <xref:System.IO.FileMode.Open?displayProperty=nameWithType> as the file mode value. If the archive does not exist, a <xref:System.IO.FileNotFoundException> exception is thrown.

## Examples

Expand Down
6 changes: 3 additions & 3 deletions xml/System.IO.Compression/ZipFileExtensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -748,11 +748,11 @@ A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> has been compressed usi
<format type="text/markdown"><![CDATA[

## Remarks
If the destination file already exists, this method does not overwrite it; it throws an <xref:System.IO.IOException> exception. To overwrite an existing file, use the <xref:System.IO.Compression.ZipFileExtensions.ExtractToFile%28System.IO.Compression.ZipArchiveEntry%2CSystem.String%2CSystem.Boolean%29> method overload instead.
If the destination file already exists, this method does not overwrite it; it throws an <xref:System.IO.IOException> exception. To overwrite an existing file, use the <xref:System.IO.Compression.ZipFileExtensions.ExtractToFile(System.IO.Compression.ZipArchiveEntry,System.String,System.Boolean)> method overload instead.

The last write time of the file is set to the last time the entry in the zip archive was changed; this value is stored in the <xref:System.IO.Compression.ZipArchiveEntry.LastWriteTime> property.

You cannot use this method to extract a directory; use the <xref:System.IO.Compression.ZipFileExtensions.ExtractToDirectory%2A> method instead.
You cannot use this method to extract a directory; use the <xref:System.IO.Compression.ZipFileExtensions.ExtractToDirectory*> method instead.

## Examples
The following example shows how to iterate through the contents of a zip archive file and extract files that have a .txt extension.
Expand Down Expand Up @@ -854,7 +854,7 @@ A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> has been compressed usi
## Remarks
The last write time of the file is set to the last time the entry in the zip archive was changed; this value is stored in the <xref:System.IO.Compression.ZipArchiveEntry.LastWriteTime> property.

You cannot use this method to extract a directory; use the <xref:System.IO.Compression.ZipFileExtensions.ExtractToDirectory%2A> method instead.
You cannot use this method to extract a directory; use the <xref:System.IO.Compression.ZipFileExtensions.ExtractToDirectory*> method instead.

## Examples
The following example shows how to iterate through the contents of a zip archive file, and extract files that have a .txt extension. It overwrites an existing file that has the same name in the destination folder. In order to compiler this code example, you must reference the `System.IO.Compression` and `System.IO.Compression.FileSystem` assemblies in your project.
Expand Down
Loading
Loading