lib/Task-Parallel-Library/StreamExtensions.cs
/// <summary>
/// Asynchronously clears all buffers for a stream and causes any buffered data to be written to the underlying device.
/// </summary>
/// <remarks>
/// If a derived class does not flush the buffer in its implementation of the <see cref="Stream.Flush()"/> method,
/// the <see cref="FlushAsync(Stream)"/> method will not flush the buffer.
/// </remarks>
/// <param name="stream">The stream to flush.</param>
/// <returns>A task that represents the asynchronous flush operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="stream"/> is <see langword="null"/>.</exception>
/// <exception cref="ObjectDisposedException">If <paramref name="stream"/> has been disposed.</exception>
Asynchronously clears all buffers for a stream and causes any buffered data to be written to the underlying device.
Asynchronously clears all buffers for a stream and causes any buffered data to be written to the underlying device .
public static Task FlushAsync(this Stream stream)
        {
            #if NET45PLUS
            if (stream == null)
            throw new ArgumentNullException("stream");
            return stream.FlushAsync();
            #else
            return FlushAsync(stream, CancellationToken.None);
            #endif
        }
public static Task FlushAsync ( this Stream stream ) { if NET45PLUS if ( stream == null ) throw new ArgumentNullException ( " " ) ; return stream . FlushAsync ( ) ; else return FlushAsync ( stream , CancellationToken . None ) ; endif }
Asynchronously clears all buffers for a stream and causes any buffered data to be written to the underlying device.
Asynchronously clears all buffers for a stream and causes any buffered data to be written to the underlying device .
// This code requires the `Stream` class provide an implementation of `FlushAsync`. The unit tests will // detect any case where this results in a stack overflow.
A task that represents the asynchronous flush operation.
A task that represents the asynchronous flush operation .
If  is .
If is .
If  has been disposed.
If has been disposed .
Stream
this
stream
The stream to flush.
The stream to flush .
remarks
If a derived class does not flush the buffer in its implementation of the  method,
the  method will not flush the buffer.
If a derived class does not flush the buffer in its implementation of the method the method will not flush the buffer .