Hello!!
I have a text file with some lines in it.
How can I know the number of lines in that file?
thanks!
:wave:
Printable View
Hello!!
I have a text file with some lines in it.
How can I know the number of lines in that file?
thanks!
:wave:
Read it in, count the number of \n characters, add one.
You can't know the number of lines without reading them. The simplest way in .NET 2.0 is:If you actually want to keep the data then you'd assign the result of ReadAllLines to a String() variable and then use the Length property of that.Code:IO.File.ReadAllLines().Length