namespace AdventCommon { public class PuzzleInput { public PuzzleInput(string fileName, bool ignoreEmptyLines = true) { using (StreamReader reader = System.IO.File.OpenText(fileName)) { while (!reader.EndOfStream) { string? line = reader.ReadLine(); if (line == null) { throw new InvalidDataException(); } if (ignoreEmptyLines && String.IsNullOrWhiteSpace(line)) continue; Lines.Add(line); } } } public List Lines { get; private set; } = new List(); public void Print() { for (int j = 0; j < Lines.Count; j++) { for (int i = 0; i < Lines[j].Length; i++) { Console.Write(Lines[j][i]); } Console.WriteLine(); } } } }