This documentation is archived and is not being maintained.

StringReader.Peek Method

Returns the next available character but does not consume it.

[Visual Basic]
Overrides Public Function Peek() As Integer
public override int Peek();
public: int Peek();
public override function Peek() : int;

Return Value

The next character to be read, or -1 if no more characters are available or the stream does not support seeking.


Exception Type Condition
ObjectDisposedException The current reader is closed.


This method overrides the TextReader.Peek method.

The current position of the StringReader is not changed by this operation.

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

See Also

StringReader Class | StringReader Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File