/// <inheritdoc/> public bool Equals(StringBag other) { return(other != null && BagColor.Equals(other.BagColor) && ContainedBag.Equals(other.ContainedBag) && ContainedQuantity == other.ContainedQuantity); }
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); }