DeflateStream.EndWrite Method

Note: This method is new in the .NET Framework version 2.0.

Ends an asynchronous write operation.

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

virtual void EndWrite (
	IAsyncResult^ asyncResult
) override
public void EndWrite (
	IAsyncResult asyncResult
public override function EndWrite (
	asyncResult : IAsyncResult



A reference to the outstanding asynchronous I/O request.

Exception typeCondition


asyncResult is a null reference (Nothing in Visual Basic).


asyncResult did not originate from a BeginWrite method on the current stream.

EndWrite must be called only once for every call to the BeginWrite method.

This method blocks until the I/O operation has completed. Errors that occur during an asynchronous write request, such as a disk failure during the I/O request, occur on the thread pool thread and become visible upon a call to EndWrite. Exceptions thrown by the thread pool thread will not be visible when calling EndWrite.

The following code example shows how to use the DeflateStream class to compress and decompress a file.


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions