Count rows in a textfile
See the question and my original answer on StackOverflowIf the file is not too big, you can do this:
File.ReadAllLines(filePath).Length;
(this will allocate the whole file, so make sure performance is not an issue)
If the file is not too big, you can do this:
File.ReadAllLines(filePath).Length;
(this will allocate the whole file, so make sure performance is not an issue)