private void MainMethod()
{
using (StreamReader sr = new StreamReader(@"F:\file.txt"))
{
string lnBuffer = string.Empty;
while (LinesAvailable(ref lnBuffer, sr.ReadLine()))
{
//Do something with lnBuffer here...
}
}
}
private bool LinesAvailable(ref string lnBuffer, string readLine)
{
lnBuffer = readLine;
return !string.IsNullOrEmpty(lnBuffer);
}