NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

StreamReader.Read (Char[], Int32, Int32)

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;

Parameters

buffer
The character array to write data to.
index
The index of buffer at which to begin writing.
count
The maximum number of characters to read.

Return Value

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.

Exceptions

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.

Remarks

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.

See Also

StreamReader Class | StreamReader Members | System.IO Namespace | StreamReader.Read Overload List