Mono Class Library: System.IO.StreamReader Overview | Members

System.IO.StreamReader.Read Method

Reads a maximum of count characters from the current stream into buffer, beginning at index. [Edit]

public override int Read (char[] buffer, int index, int count)

Parameters

buffer
A char array. When this method returns, contains the specified character array with the values between index and (index + count - 1) replaced by the characters read from the current instance. [Edit]
index
A int that specifies the index of buffer at which to begin writing. [Edit]
count
A int that specifies the maximum number of characters to read. [Edit]

Returns

A int containing the number of characters that have been read, or zero if there are no more characters left to read. Can be less than count if the end of the stream has been reached. [Edit]

Exceptions

TypeReason
ArgumentExceptionbuffer .Length - index < count . [Edit]
ArgumentNullExceptionbuffer is null. [Edit]
ArgumentOutOfRangeExceptionindex or count is negative. [Edit]
System.IO.IOException

An I/O error occurred.

-or-

The current stream is closed.

[Edit]

Remarks

Note:

This method returns after either count characters are read, or the end of the file is reached. TextReader.ReadBlock(Char[], int, int) is a blocking version of StreamReader.Read .

This method overrides TextReader.Read.

[Edit]

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0