Click or drag to resize
StreamCopyTo Method (Stream)
Reads the bytes from the current stream and writes them to the destination stream.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public void CopyTo(
	Stream destination
)

Parameters

destination
Type: System.IOStream
The stream that will contain the contents of the current stream.
Exceptions
ExceptionCondition
ArgumentNullExceptiondestination is null.
NotSupportedExceptionThe current stream does not support reading.-or-destination does not support writing.
ObjectDisposedExceptionEither the current stream or destination were closed before the CopyTo(Stream) method was called.
IOExceptionAn I/O error occurred.
See Also