Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

StringReader.Peek Method

Returns the next available character but does not consume it.

[Visual Basic]
Overrides Public Function Peek() As Integer
[C#]
public override int Peek();
[C++]
public: int Peek();
[JScript]
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.

Exceptions

Exception Type Condition
ObjectDisposedException The current reader is closed.

Remarks

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

Requirements

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft