Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UnmanagedMemoryStream.Write Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Writes a block of bytes to the current stream using data from a buffer.

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

public override void Write(
	byte[] buffer,
	int offset,
	int count


Type: System.Byte[]
The byte array from which to copy bytes to the current stream.
Type: System.Int32
The offset in the buffer at which to begin copying bytes to the current stream.
Type: System.Int32
The number of bytes to write to the current stream.


The stream is closed.


The underlying memory does not support writing.

- or -

An attempt is made to write to the stream and the CanWrite property is false.

- or -

The count value is greater than the capacity of the stream.

- or -

The position is at the end of the stream capacity.


An I/O error occurs.


One of the specified parameters is less than zero.


The offset parameter minus the length of the buffer parameter is less than the count parameter.


The buffer parameter is null.

Writing occurs at the current position in the stream.


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

© 2017 Microsoft