Skip to content

Instantly share code, notes, and snippets.

@ronnieoverby
Created December 11, 2013 19:33
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ronnieoverby/7916886 to your computer and use it in GitHub Desktop.
Save ronnieoverby/7916886 to your computer and use it in GitHub Desktop.
internal static IEnumerable<string> ReadLines(this string s)
{
string line;
using (var sr = new StringReader(s))
while ((line = sr.ReadLine()) != null)
yield return line;
}
@SQLEmil
Copy link

SQLEmil commented Mar 15, 2017

Thanks very much for this - saved me a bunch of time as newbie C# guy who got the right approach but not how to write it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment