Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.26 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public static IEnumerable<string> ReadLinesFromTextFile(this string filename)
  2. {
  3.     using (var reader = new StreamReader(filename))
  4.     {
  5.         string line;
  6.         while ((line = reader.ReadLine()) != null)
  7.         {
  8.             yield return line;
  9.         }
  10.     }
  11. }