int i = 0; FileStream fs = new FileStream(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); using (StreamReader sr = new StreamReader(fs, System.Text.Encoding.Default)) { while (sr.Peek() > -1) { i++; if (i > LineNum) { Console.WriteLine("T:" + sr.ReadLine()); } else { sr.ReadLine(); Console.WriteLine("F:" + sr.ReadLine()); } } } if (i != 0) { LineNum = i; Console.WriteLine("LineNum:" + LineNum); }