1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
/// <summary>
/// Counts the lines of a File.
/// </summary>
/// <param name="fileToCount">The file to count.</param>
/// <returns>lines of a File</returns>
private static int CountLines(string fileToCount)
{
int counter = 0;
using (StreamReader countReader = new StreamReader(fileToCount))
{
while (countReader.ReadLine() != null)
counter++;
}
return counter;
}
|