public void ReadInput() { var path = Path.Combine(Directory.GetCurrentDirectory(), InputFile); using (var reader = File.OpenText(path)) { var line = reader.ReadLine(); while (line is not null) { List <int> temp = new List <int>(); foreach (var value in line.ToList()) { temp.Add(value - '0'); } HeightMap.Add(new List <int>(temp)); temp.Clear(); line = reader.ReadLine(); } } }