RecyclableMemoryStream.WriteTo method (1 of 5)

December 6, 2023 · View on GitHub

Writes bytes from the current stream to a destination byte array.

public void WriteTo(byte[] buffer)
parameterdescription
bufferTarget buffer.

Exceptions

exceptioncondition
ArgumentNullExceptionbuffer> is null.
ObjectDisposedExceptionObject has been disposed.

Remarks

The entire stream is written to the target array.

See Also


RecyclableMemoryStream.WriteTo method (2 of 5)

Synchronously writes this stream's bytes to the argument stream.

public override void WriteTo(Stream stream)
parameterdescription
streamDestination stream.

Exceptions

exceptioncondition
ArgumentNullExceptionstream is null.
ObjectDisposedExceptionObject has been disposed.

Remarks

Important: This does a synchronous write, which may not be desired in some situations.

See Also


RecyclableMemoryStream.WriteTo method (3 of 5)

Writes bytes from the current stream to a destination byte array.

public void WriteTo(byte[] buffer, long offset, long count)
parameterdescription
bufferTarget buffer.
offsetOffset in the source stream, from which to start.
countNumber of bytes to write.

Exceptions

exceptioncondition
ArgumentNullExceptionbuffer> is null.
ArgumentOutOfRangeExceptionoffset is less than 0, or offset + count is beyond this stream's length.
ObjectDisposedExceptionObject has been disposed.

See Also


RecyclableMemoryStream.WriteTo method (4 of 5)

Synchronously writes this stream's bytes, starting at offset, for count bytes, to the argument stream.

public void WriteTo(Stream stream, long offset, long count)
parameterdescription
streamDestination stream.
offsetOffset in source.
countNumber of bytes to write.

Exceptions

exceptioncondition
ArgumentNullExceptionstream is null.
ArgumentOutOfRangeExceptionoffset is less than 0, or offset + count is beyond this stream's length.
ObjectDisposedExceptionObject has been disposed.

See Also


RecyclableMemoryStream.WriteTo method (5 of 5)

Writes bytes from the current stream to a destination byte array.

public void WriteTo(byte[] buffer, long offset, long count, int targetOffset)
parameterdescription
bufferTarget buffer.
offsetOffset in the source stream, from which to start.
countNumber of bytes to write.
targetOffsetOffset in the target byte array to start writing

Exceptions

exceptioncondition
ArgumentNullExceptionbuffer is null
ArgumentOutOfRangeExceptionoffset is less than 0, or offset + count is beyond this stream's length.
ArgumentOutOfRangeExceptiontargetOffset is less than 0, or targetOffset + count is beyond the target buffer's length.
ObjectDisposedExceptionObject has been disposed.

See Also