public void PrintVegeterianMenu() { var enumerator = menuComponent.CreateEnumerator(); while (enumerator.MoveNext()) { var item = enumerator.Current; if (item.IsVegeterian == true) { item.Print(); } } }
public void PrintVegetarianMenu() { var enumerator = _allMenus.CreateEnumerator(); Console.WriteLine("\nVEGETARIAN MENU\n--------"); while (enumerator.MoveNext()) { var menuComponent = enumerator.Current; try { if (menuComponent.IsVegetarian) { menuComponent.Print(); } } catch (NotSupportedException e) { } } }