I am looking for the C # equivalent for the unread () Java method.
the C # equivalent for PushbackReader is supposedly System.IO.StreamReader, but StreamReader does not have an βunread ()β equivalent. It has Peek (), but there is no way to return a character to 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) {} }
source share