Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.
- cancellationToken
- The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
A task that represents the asynchronous flush operation.
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.