This documentation is archived and is not being maintained.

StringReader.Read Method

Reads the next character or next set of characters from the input string.

Overload List

Reads the next character from the input string and advances the character position by one character.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Overrides Public Function Read() As Integer
[C#] public override int Read();
[C++] public: int Read();
[JScript] public override function Read() : int;

Reads a block of characters from the input string and advances the character position by count.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Overrides Public Function Read(Char(), Integer, Integer) As Integer
[C#] public override int Read(char[], int, int);
[C++] public: int Read(__wchar_t __gc[], int, int);
[JScript] public override function Read(Char[], int, int) : int;

Example

[Visual Basic, C#, C++] This code example is part of a larger example provided for the StringReader class.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of Read. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
convertedCharacter = Convert.ToChar(intCharacter)
If convertedCharacter = "."C Then
    strWriter.Write("." & vbCrLf & vbCrLf)

    ' Bypass the spaces between sentences.
    strReader.Read()
    strReader.Read()

[C#] 
convertedCharacter = Convert.ToChar(intCharacter);
if(convertedCharacter == '.')
{
    strWriter.Write(".\n\n");

    // Bypass the spaces between sentences.
    strReader.Read();
    strReader.Read();
}

[C++] 
convertedCharacter = Convert::ToChar(intCharacter);
if(convertedCharacter == '.')
{
    strWriter->Write(".\n\n");

    // Bypass the spaces between sentences.
    strReader->Read();
    strReader->Read();
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

StringReader Class | StringReader Members | System.IO Namespace

Show: