System.IO.Stream.FlushAsync Method

Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

Syntax

public virtual System.Threading.Tasks.Task FlushAsync (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.

Returns

A task that represents the asynchronous flush operation.

Remarks

If the operation is canceled before it completes, the returned task contains the System.Threading.Tasks.TaskStatus.Canceled value for the System.Threading.Tasks.Task.Status property.

If a derived class, such as System.IO.Compression.DeflateStream or System.IO.Compression.GZipStream, does not flush the buffer in its implementation of the Stream.Flush method, the Stream.FlushAsync(System.Threading.CancellationToken) method will not flush the buffer.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0