Skip to content

Instantly share code, notes, and snippets.

@SamKr
Last active March 12, 2019 10:15
Show Gist options
  • Select an option

  • Save SamKr/d7c786490a84f0f80b249564efd80b8c to your computer and use it in GitHub Desktop.

Select an option

Save SamKr/d7c786490a84f0f80b249564efd80b8c to your computer and use it in GitHub Desktop.
Iterate through multiline string, checking for null
if (!string.IsNullOrEmpty(multiLineString))
{
using (var reader = new StringReader(multiLineString))
{
string line;
while ((line = reader.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment