Reads the next character without changing the state of the reader or the character source. Returns the next available character without actually reading it from the input stream.
[Visual Basic] Public Overridable Function Peek() As Integer [C#] public virtual int Peek(); [C++] public: virtual int Peek(); [JScript] public function Peek() : int;
The next character to be read, or -1 if no more characters are available or the stream does not support seeking.
|ObjectDisposedException||The TextReader is closed.|
|IOException||An I/O error occurs.|
The current position of the TextReader is not changed by this operation. The returned value is -1 if no more characters are available. The default implementation returns -1.
The following table lists examples of other typical or related I/O tasks.
|To do this...||See the example in this topic...|
|Create a text file.||Writing Text to a File|
|Write to a text file.||Writing Text to a File|
|Read from a text file.||Reading Text from a File|
|Get the size of a file.||FileInfo.Length|
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard