Table of Contents

CopyToAsync Method

Definition

CopyToAsync(IDecorator<TextReader>, TextWriter, int)

Asynchronously reads the bytes from the enclosed TextReader of the specified decorator and writes them to the writer.

public static Task CopyToAsync(this IDecorator<TextReader> decorator, TextWriter writer, int bufferSize = 81920)

Parameters

decorator IDecorator<TextReader>

The IDecorator<T> to extend.

writer TextWriter

The TextWriter to asynchronously write bytes to.

bufferSize int

The size, in bytes, of the buffer. This value must be greater than zero. The default size is 81920.

Returns

Task

A task that represents the asynchronous copy operation.

Exceptions

ArgumentNullException

decorator cannot be null -or- writer cannot be null.

ArgumentOutOfRangeException

bufferSize is lower than or equal to 0.