Ejemplo n.º 1
0
 public void CheckPrice(CheckFlightDelegate cfd, int price)
 {
     if (price < this.price)
     {
         cfd(this);
     }
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Flight flight = new Flight();
            flight[0] = new Flight();
            flight[1] = new Flight();

            flight[0].id = 1000;
            flight[0].origin = "Honduras";
            flight[0].dest = "Siberia";
            flight[0].date = "2015-01-01";
            flight[0].price = 100;
            flight[1].id = 2000;
            flight[1].origin = "Siberia";
            flight[1].dest = "Honduras";
            flight[1].date = "2016-01-01";
            flight[1].price = 200;

            Console.WriteLine(Flight.SearchFlight(flight, 1000));

            CheckFlightDelegate cfdFull = new CheckFlightDelegate(Flight.ShowFullFlightInfo);
            CheckFlightDelegate cfdLimited = new CheckFlightDelegate(Flight.ShowLimitedFlightInfo);
            CheckFlightDelegate cfd = cfdFull + cfdLimited;
            flight[0].CheckPrice(cfd, 50);

            Console.WriteLine("Press enter to close...");
            Console.ReadLine();
        }