CopyTo Method (Stream)
Collapse the table of content
Expand the table of content

Stream.CopyTo Method (Stream)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Reads all the bytes from the current stream and writes them to the destination stream.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

public void CopyTo(
	Stream destination
)

Parameters

destination
Type: System.IO.Stream
The stream that will contain the contents of the current stream.

ExceptionCondition
ArgumentNullException

destination is null.

NotSupportedException

The current stream does not support reading.

-or-

destination does not support writing.

ObjectDisposedException

Either the current stream or destination were closed before the CopyTo method was called.

IOException

An I/O error occurred.

Copying begins at the current position in the current stream.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2017 Microsoft