Mega Code Archive

 
Categories / C# / Data Types
 

Split the multi-line output into separate line strings

using System; using System.Collections.Generic; using System.IO; class OutputParsingUtilities {     public static string[] SplitIntoLines(string output)     {         if (output == null)             throw new ArgumentNullException("output");         var result = new List<string>();         using (var reader = new StringReader(output))         {             string line;             while ((line = reader.ReadLine()) != null)                 result.Add(line);         }         return result.ToArray();     } }