lib/Task-Parallel-Library/StreamExtensions.cs
/// <summary>
/// Asynchronously reads the bytes from a source stream and writes them to a destination stream.
/// </summary>
/// <remarks>
/// Copying begins at the current position in <paramref name="stream"/>.
/// </remarks>
/// <param name="stream">The source stream.</param>
/// <param name="destination">The stream to which the contents of the source stream will be copied.</param>
/// <returns>A task that represents the asynchronous copy operation.</returns>
/// <exception cref="ArgumentNullException">
/// <para>If <paramref name="stream"/> is <see langword="null"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="destination"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ObjectDisposedException">
/// <para>If <paramref name="stream"/> is disposed.</para>
/// <para>-or-</para>
/// <para>If <paramref name="destination"/> is disposed.</para>
/// </exception>
/// <exception cref="NotSupportedException">
/// <para>If <paramref name="stream"/> does not support reading.</para>
/// <para>-or-</para>
/// <para>If <paramref name="destination"/> does not support writing.</para>
/// </exception>
Asynchronously reads the bytes from a source stream and writes them to a destination stream.
Asynchronously reads the bytes from a source stream and writes them to a destination stream .
public static Task CopyToAsync(this Stream stream, Stream destination)
        {
            #if NET45PLUS
            if (stream == null)
            throw new ArgumentNullException("stream");
            return stream.CopyToAsync(destination);
            #else
            return CopyToAsync(stream, destination, 16 * 1024, CancellationToken.None);
            #endif
        }
public static Task CopyToAsync ( this Stream stream , Stream destination ) { if NET45PLUS if ( stream == null ) throw new ArgumentNullException ( " " ) ; return stream . CopyToAsync ( destination ) ; else return CopyToAsync ( stream , destination , 16 * 1024 , CancellationToken . None ) ; endif }
Asynchronously reads the bytes from a source stream and writes them to a destination stream.
Asynchronously reads the bytes from a source stream and writes them to a destination stream .
// This code requires the `Stream` class provide an implementation of `CopyToAsync`. The unit tests will // detect any case where this results in a stack overflow.
A task that represents the asynchronous copy operation.
A task that represents the asynchronous copy operation .
If  is .-or-If  is .
If is . - or - If is .
If  is disposed.-or-If  is disposed.
If is disposed . - or - If is disposed .
If  does not support reading.-or-If  does not support writing.
If does not support reading . - or - If does not support writing .
Stream
this
destination
Stream
The stream to which the contents of the source stream will be copied.
The stream to which the contents of the source stream will be copied .
stream
The source stream.
The source stream .
remarks
Copying begins at the current position in .
Copying begins at the current position in .