Share via


BinaryReader.Read Method (array<Byte[], Int32, Int32)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Reads count bytes from the stream with index as the starting point in the byte array.

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

Syntax

'Declaration
Public Overridable Function Read ( _
    buffer As Byte(), _
    index As Integer, _
    count As Integer _
) As Integer
public virtual int Read(
    byte[] buffer,
    int index,
    int count
)

Parameters

  • buffer
    Type: array<System.Byte[]
    The buffer to read data into.
  • index
    Type: System.Int32
    The starting point in the buffer at which to begin reading into the buffer.
  • count
    Type: System.Int32
    The number of characters to read.

Return Value

Type: System.Int32
The number of characters read into buffer. This might be less than the number of bytes requested if that many bytes are not available, or it might be zero if the end of the stream is reached.

Exceptions

Exception Condition
ArgumentException

The buffer length minus index is less than count.

ArgumentNullException

buffer is nulla null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

index or count is negative.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurs.

Version Information

Silverlight

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

Platforms

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