SamKr
3/11/2019 - 9:24 AM

Iterate Multiline String

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);
        }
    }
}