Table of Contents

CopyToAsync Method

Definition

Namespace
Cuemon.Extensions.IO
Assemblies
Cuemon.Extensions.IO.dll
Source
src/Cuemon.Extensions.IO/TextReaderExtensions.cs

CopyToAsync(TextReader, TextWriter, int)

Asynchronously reads the bytes from the reader and writes them to the writer.

public static Task CopyToAsync(this TextReader reader, TextWriter writer, int bufferSize = 81920)

Parameters

reader TextReader

The TextReader 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

reader cannot be null -or- writer cannot be null.

ArgumentOutOfRangeException

bufferSize is lower than or equal to 0.