> I would use System.IO.File.ReadAllLines(Filename), because this
> returns the lines split out for you. You just loop through the array
> of individual lines in the array.
I did originally write the same thing in my message but then chose to remove
it before I posted it. I think the ReadAllText approach may be quicker
because you can check whether the string exists at all without having to
loop... You could them possible determine the line by using a call to
Replace() on the string prior to the search result position, changing the
two-character line break with a one-character replacement string, and then
see how much smaller the string has got; the number of characters it reduces
by will be the line count.
Maybe needs someone to try it to see which is more efficient.

Signature
(O)enone
Clinto - 01 Mar 2008 04:12 GMT
On Feb 28, 6:58 am, "\(O\)enone" <oen...@nowhere.com> wrote:
> > I would use System.IO.File.ReadAllLines(Filename), because this
> > returns the lines split out for you. You just loop through the array
[quoted text clipped - 14 lines]
>
> (O)enone
Thanks everyone, I appreciate the responses. I tried several methods,
ReadAllText, io.filestream, readallLines and all seem about the same.
It became apparent that I am also fighting a slow server connection,
which increases the time to open the files.