protected List <Passport> GetValidPassports() { var cleanedInputs = new List <string>(); var validPassports = new List <Passport>(); var inputToString = PuzzleInput .Aggregate((i, j) => i + " " + j) .Split(" "); var validFields = new string[] { "byr:", "iyr:", "eyr:", "hgt:", "hcl:", "ecl:", "pid:", }; foreach (var item in inputToString) { var passport = new Passport(item, validFields); if (passport.isValid()) { validPassports.Add(passport); } } return(validPassports); }