Share via


Read Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

Namespace:  System.IO
Assembly:  System.IO (in System.IO.dll)

Syntax

'Declaration
Public Overrides Function Read As Integer
public override int Read()
public:
virtual int Read() override
abstract Read : unit -> int 
override Read : unit -> int 
public override function Read() : int

Return Value

Type: System. . :: . .Int32
The next character from the input stream represented as an Int32 object, or -1 if no more characters are available.

Remarks

This method overrides Read.

This method returns an integer so that it can return -1 if the end of the stream has been reached. If you manipulate the position of the underlying stream after reading data into the buffer, the position of the underlying stream might not match the position of the internal buffer. To reset the internal buffer, call the DiscardBufferedData method; however, this method slows performance and should be called only when absolutely necessary.

.NET Framework Security

See Also

Reference

StreamReader Class

Read Overload

System.IO Namespace