Exemplo n.º 1
0
        /// <summary>
        /// Returns a list of pilots of a certain age.
        /// </summary>
        /// <param name="lowerAge">Lower age of pilots who should be returned.</param>
        /// <param name="upperAge">Upper age of pilots who should be returned.</param>
        /// <returns></returns>
        public MyListOfPilots GetPilotsOfAge(int lowerAge, int upperAge)
        {
            MyListOfPilots cityFlights = new MyListOfPilots();

            foreach (Pilot p in pilots)
            {
                if (p.Age >= lowerAge && p.Age <= upperAge)
                {
                    cityFlights.Add(p);
                }
            }
            return(cityFlights);
        }