// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; namespace E { public class Program { public static void Main(string[] args) { string txt = "A\r\nBB\r\nCCC"; foreach(string line1 in txt.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)) { Console.WriteLine(line1); } StringReader sr = new StringReader(txt); string line2; while((line2 = sr.ReadLine()) != null) { Console.WriteLine(line2); } } } }