foreach (var line in File.ReadLines("Filename"))
{
// ...process line.
}
private static String[] InternalReadAllLines(String path, Encoding encoding)
{
String line;
List<String> lines = new List<String>();
using (StreamReader sr = new StreamReader(path, encoding))
while ((line = sr.ReadLine()) != null)
lines.Add(line);
return lines.ToArray();
}