I\'m reading a file in line-by-line and I want to be able to restart the read by calling a method Rewind().
How can I manipulate my System.IO.Stre
The question is looking for some kind of StreamReader.Rewind() method.
You are looking for StreamReader.BaseStream.Position = 0; which sets the reader back to the beginning so it can be read again.
StreamReader sr = new StreamReader("H:/kate/rani.txt");
Console.WriteLine(sr.ReadToEnd());
sr.BaseStream.Position = 0;
Console.WriteLine("----------------------------------");
while (!sr.EndOfStream)
{
Console.WriteLine(sr.ReadLine());
}