Again, going with other people's comments about memory, how about using a Streamreader
? (I haven't tested the timings (or code) but from memory..
This should be fast (and memory efficient)...at least in my experience.
StreamReader sr = new StreamReader("Put file here");
Int32 cnt = 0;
while (sr.ReadLine() != null)
{
cnt++;
}