Ooops!! I meant to write While, rather than for each. I don't think for each in my code even works properly as it is written. I will update and make note.
On a side note, why is For Each less efficient than While? Aren't they the same in this context?
foreach will make a list out of the file's contents and then will iterate, so it will read the whole file into memory.
while has a small footprint since it goes through the contents line by line plus it terminates when the the condition will evaluate to false;with foreach you go through everything in the list