示例#1
0
 /// <inheritdoc/>
 public bool Equals(StringBag other)
 {
     return(other != null &&
            BagColor.Equals(other.BagColor) &&
            ContainedBag.Equals(other.ContainedBag) &&
            ContainedQuantity == other.ContainedQuantity);
 }
示例#2
0
        private long CountBagsIn(ContainedBag contained)
        {
            if (contained.bag.containedBags.Count == 0)
            {
                return(0);
            }
            long ctr = 0;

            foreach (var bag in contained.bag.containedBags)
            {
                ctr += bag.number + bag.number * CountBagsIn(bag);
            }
            return(ctr);
        }