BinaryReader.Read Method (Char[], Int32, Int32)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Reads count characters from the stream with index as the starting point in the character array.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- buffer
- Type:
System.Char
[]
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.Int32The total number of characters read into the buffer. This might be less than the number of characters requested if that many characters are not currently available, or it might be zero if the end of the stream is reached.
| Exception | Condition |
|---|---|
| ArgumentException | The buffer length minus index is less than count. -or- The number of decoded characters to read is greater than count. This can happen if a Unicode decoder returns fallback characters or a surrogate pair. |
| ArgumentNullException | buffer is null. |
| ArgumentOutOfRangeException | index or count is negative. |
| ObjectDisposedException | The stream is closed. |
| IOException | An I/O error occurs. |
BinaryReader does not restore the file position after an unsuccessful read operation.