UnmanagedMemoryStream.Write Method

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

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

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

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

Syntax

Public Overrides Sub Write ( _
    buffer As Byte(), _
    offset As Integer, _
    count As Integer _
)
public override void Write(
    byte[] buffer,
    int offset,
    int count
)

Parameters

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

Exceptions

Exception Condition
ObjectDisposedException

The stream is closed.

NotSupportedException

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.

IOException

An I/O error occurs.

ArgumentOutOfRangeException

One of the specified parameters is less than zero.

ArgumentException

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

ArgumentNullException

The buffer parameter is nullNothingnullptra null reference (Nothing in Visual Basic).

Remarks

Writing occurs at the current position in the stream.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

UnmanagedMemoryStream Class

System.IO Namespace