/// /// Counts the lines of a File. /// /// The file to count. /// lines of a File private static int CountLines(string fileToCount) { int counter = 0; using (StreamReader countReader = new StreamReader(fileToCount)) { while (countReader.ReadLine() != null) counter++; } return counter; }