示例#1
0
        static FoodCollection Menu()
        {
            FoodCollection collection = new FoodCollection();

            collection[0] = new Pizza("Neapolitana", 80, new Neapolitana());
            collection[1] = new Pizza("Diablo", 80, new Diablo());
            collection[2] = new Pizza("Rancho", 70, new Rancho());
            collection[5] = new Pizza("Capricioasa", 85, new Capricioasa());

            Console.WriteLine("----------------------Menu---------------------");
            PizzaIterator iterator = collection.CreateIterator();

            for (Pizza item = iterator.First(); !iterator.IsDone; item = iterator.Next())
            {
                Console.WriteLine(iterator.ItemIndex + 1 + ")" + item.Name + "\t" + item.Price + " mdl");
            }

            return(collection);
        }
示例#2
0
        static FoodCollection Menu()
        {
            FoodCollection collection = new FoodCollection();

            collection[0] = new Pizza("Diavola", 80, new Diavola());
            collection[1] = new Pizza("Broccoli", 80, new Broccoli());
            collection[2] = new Pizza("Carciofini", 70, new Carciofini());
            collection[5] = new Pizza(" Neptun", 85, new Neptun());

            Console.WriteLine("----------------------Menu---------------------");
            PizzaIterator iterator = collection.CreateIterator();

            for (Pizza item = iterator.First(); !iterator.IsDone; item = iterator.Next())
            {
                Console.WriteLine(iterator.ItemIndex + 1 + ")" + item.Name + "\t" + item.Price + " mdl");
            }

            return(collection);
        }