public static WeightedDishList Parse(XElement xml) { if (xml == null || xml.Name != typeof(WeightedDishList).Name) { throw new ArgumentException(); } WeightedDishList result = new WeightedDishList(); foreach (var item in xml.Elements(typeof(WeightedDish).Name)) { WeightedDish ingredient = WeightedDish.Parse(item); result.Add(ingredient); } return(result); }
private static string GetDishesString(WeightedDishList list) { var builder = new StringBuilder(); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count - 1; i++) { if (!list[i].HiddenWhenPrinting) { builder.Append(list[i].Dish.Name); } builder.AppendLine(); } builder.Append(list[list.Count - 1].Dish.Name); } return(builder.ToString()); }
/// <summary> /// /// </summary> public PartyProject() { this.LeftDishList = new WeightedDishList(); this.RightDishList = new WeightedDishList(); this.Count = 10; }