File Count Lines
Description: Very fast method to count the lines in a file.
Link: http://www.codekeep.net/snippets/84502287-a10f-4f15-871b-86df47f9d8f4.aspx
private int CountFileLines(string FileName)
{
TextReader reader = File.OpenText(FileName);
char[] buffer = new char[32 * 1024]; // Read 32K chars at a time
int total = 1; // All files have at least one line!
int read;
while ((read = reader.Read(buffer, 0, buffer.Length)) > 0)
{
for (int i = 0; i < read; i++)
{
if (buffer[i] == '\n')
{
total++;
}
}
}
return total;
}






