forked from abishekaditya/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBreakfastMenu.cs
35 lines (28 loc) · 909 Bytes
/
BreakfastMenu.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Collections;
namespace IteratorPattern
{
public class BreakfastMenu
{
private ArrayList _items;
public IEnumerable Items
{
get
{
return new BreakfastMenuIterator(_items);
}
}
public BreakfastMenu()
{
_items = new ArrayList();
AddItem("Waffle", "Blueberry Sauce topped breakfast Waffles", 125, false);
AddItem("Sandwich", "Veggie Sandwich with tomato and cucumber", 75, true);
AddItem("Pankcakes", "Maple syrup Pancakes",110,false);
AddItem("Corn Flakes", "Cornflakes with fruits and nuts",60,true);
}
private void AddItem(string name, string description, int price, bool veg)
{
var item = new Menu(name,description,price,veg);
_items.Add(item);
}
}
}