Beispiel #1
0
        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);
        }