MemoryStream.CopyTo(Stream, Int32) Method

Definition

Reads the bytes from the current memory stream and writes them to another stream, using a specified buffer size.

public override void CopyTo (System.IO.Stream destination, int bufferSize);

Parameters

destination
Stream

The stream to which the contents of the current memory stream will be copied.

bufferSize
Int32

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

Exceptions

destination is null.

bufferSize is not a positive number.

Either the underlying memory stream or the destination stream is closed.

The underlying memory stream is unreadable.

-or-

The destination stream is unwritable.

Applies to

Produkt Versioner
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Standard 2.1