I'm looking for a C# equivalent to the Java's unread() method.
The C# equivalent to PushbackReader is supposedly System.IO.StreamReader, but StreamReader doesnt have an "unread()" equivalent. It has Peek(), but no way to put a character back onto the stream.
Java Code:
// putBackChar puts the character back onto the stream
// adjusts current line number if necessary
private void putBackChar()
{
if (ch == '\n')
currentLine--;
try
{
in.unread((int) ch);
}
catch (IOException e)
{}
}