I'm trying to read the number of lines of a file. I found here (stackoverflow) that the best way to read the number of lines in a large file is to use the following code:
int count = System.IO.File.ReadLines(file).Count();
However, I can not compile it. Does anyone know what the problem is?
Error 5 'System.Collections.Generic.IEnumerable<string>'does not contain the definition of “Count” and the extension method “Count”. Taking the first argument of the type 'System.Collections.Generic.IEnumerable<string>'can be found (do you have a using directive or an assembly reference?)
Thank you Eyal
Eyalk source
share