public void PrintVegetarianMenu() { IEnumerator <MenuComponent> iterator = _menuComponent.CreateIterator(); Console.WriteLine("\n VEGETARIAN MENU \n --------"); while (iterator.MoveNext()) { MenuComponent menuComponent = iterator.Current; menuComponent.Print(); } }
public static void Start(MenuComponent component) { var componentIterator = component.CreateIterator(); CompositeIterator iterator = new CompositeIterator(componentIterator); while (iterator.MoveNext()) { MenuComponent innerComponent = iterator.Current as MenuComponent; } }