Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
internal static IEnumerable<string> ReadLines(this string s)
string line;
using (var sr = new StringReader(s))
while ((line = sr.ReadLine()) != null)
yield return line;

This comment has been minimized.

Copy link

@SQLEmil 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