Reads a maximum of count characters from the current stream and writes the data to buffer, beginning at index.
[Visual Basic] Overloads Overrides Public Function Read( _ ByVal buffer() As Char, _ ByVal index As Integer, _ ByVal count As Integer _ ) As Integer [C#] public override int Read( char[] buffer, int index, int count ); [C++] public: override int Read( __wchar_t* buffer[], int index, int count ); [JScript] public override function Read( buffer : Char[], index : int, count : int ) : int;
The number of characters that have been read. The number will be less than or equal to count, depending on whether the data is available within the stream.
Exception Type | Condition |
---|---|
ArgumentException | The buffer length minus index is less than count. |
ArgumentNullException | buffer is a null reference (in Visual Basic Nothing). |
ArgumentOutOfRangeException | index or count is negative. |
IOException | An I/O error occurs. |
StreamReader.Read(char[], int, int) and Write (char[], int, int) read and write the number of characters specified by the count parameter. These are to be distinguished from Read and Write, which read and write the number of bytes specified by the count parameter. Use the BufferedStream methods only for reading and writing an integral number of byte array elements.
This method returns after either count characters are read, or the end of the file is reached. ReadBlock is a blocking version of StreamReader.Read.
StreamReader Class | StreamReader Members | System.IO Namespace | StreamReader.Read Overload List