Exemplo n.º 1
0
        public void Run()
        {
            string input;

            while ((input = Console.ReadLine()) != "End")
            {
                residents.Add(factory.GetResident(input));
            }
            string idToLookFOr = Console.ReadLine();

            foreach (IDPosses resident in residents.Where(x => x.Id.EndsWith(idToLookFOr)))
            {
                Console.WriteLine(resident.Id);
            }
        }
Exemplo n.º 2
0
        public void Run()
        {
            string input;

            while ((input = Console.ReadLine()) != "End")
            {
                residents.Add(factory.GetResident(input));
            }
            residents = residents.Where(x => x != null).ToList();
            string yearToLookFOr = Console.ReadLine();

            foreach (IBirthable newborn in residents.Where(x => x is IBirthable).Select(x => (IBirthable)x).Where(x => x.BirthDay.EndsWith(yearToLookFOr)))
            {
                Console.WriteLine(newborn.BirthDay);
            }
        }