C# StringReader Peek

Description

StringReader Peek Returns the next available character but does not consume it.

Syntax

StringReader.Peek has the following syntax.


public override int Peek()

Returns

StringReader.Peek method returns An integer representing the next character to be read, or -1 if no more characters are available or the stream does not support seeking.

Example


using System;/*from   w w  w.j a v  a2 s . c  o  m*/
using System.IO;
public class MainClass{
  public static void Main(String[] argv){  
    StringReader strReader = new StringReader("java2s.com");
    Console.WriteLine(strReader.Peek());
  }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter