public void Remove(string code) { if (this.distributionList.ContainsKey(code)) { distributeObj obj = (distributeObj)this.distributionList[code]; this.distributionList.Remove(code); this.totalWeight -= obj.weight; } }
public void Add(string code, decimal weight) { if (this.distributionList.ContainsKey(code)) { distributeObj obj = (distributeObj)this.distributionList[code]; obj.weight += weight; this.distributionList[code] = obj; } else { this.distributionList.Add(code, new distributeObj(weight, 0)); } this.totalWeight += weight; }