/// <summary> /// 烹飪指定的菜餚。 /// </summary> /// <param name="burgerType">漢堡的種類。</param> /// <returns> /// 烹飪後的菜餚。 /// </returns> public string Cook(BurgerEnum burgerType) { Burger burger; if (this._burgerRecipes.TryGetValue(burgerType, out burger) == false) { return("菜單上沒有這個漢堡。"); } var cookingMethod = burger.GetCookingMethod(); var cookedBurger = new StringBuilder() .AppendLine(cookingMethod) .AppendLine($"Your {burger.Name} is ready. Enjoy it!") .ToString(); return(cookedBurger); }
public IExtra this[BurgerEnum key] { get { return(ingredients[key]); } set { ingredients[key] = value; } }