I am using a list to limit the file size since the target is limited in disk and ram. This is what I am doing now but is there a more efficient way?
readonly
List lines = new List(); using (var sr = new StreamReader("file.txt")) { while (sr.Peek() >= 0) lines.Add(sr.ReadLine()); }
i would suggest this... of Groo's answer.