public static void Main() { var inhabitans = new List <IInhabitant>(); var factory = new InhabitantFactory(); string input; while ((input = Console.ReadLine()) != "End") { inhabitans.Add(factory.CreateInhabitant(input.Split().ToArray())); } var idPart = Console.ReadLine(); foreach (var inhabitant in inhabitans.Where(i => i.Id.EndsWith(idPart))) { Console.WriteLine(inhabitant.Id); } }
public static void Main() { var beings = new List <IBeing>(); var factory = new InhabitantFactory(); string input; while ((input = Console.ReadLine()) != "End") { var being = factory.CreateBeing(input.Split()); if (being != null) { beings.Add(being); } } var year = Console.ReadLine(); foreach (var being in beings.Where(b => b.Birthdate.EndsWith(year))) { Console.WriteLine(being.Birthdate); } }
public Engine() { inhabitantFactory = new InhabitantFactory(); }