示例#1
0
 public void Remove(MultiSet <KEY> multiSet)
 {
     foreach (KEY local in multiSet)
     {
         if (this._values.ContainsKey(local))
         {
             int num = this._values[local].Value - multiSet.Occurrence(local);
             if (num > 0)
             {
                 this._values[local] = new int?(num);
                 continue;
             }
             this._values.Remove(local);
         }
     }
 }
示例#2
0
        public void AddAll(ICollection <KEY> collection)
        {
            MultiSet <KEY> set = collection as MultiSet <KEY>;

            if (set != null)
            {
                foreach (KEY local in set)
                {
                    this.Add(local, set.Occurrence(local));
                }
            }
            else
            {
                foreach (KEY local2 in collection)
                {
                    this.Add(local2);
                }
            }
        }