void Removeltems(Dictionary<int, ltem> _dicltemMap, ltem _item)

{

List<ltem> keys=new List<ltem>();

            foreach (var KV in _dicltemMap)

            {

                if (KV.Value.Equals(_item))

                {

                    keys.Add(KV.Key);

                }

            }

            for (int i = 0; i < keys.Count; i++)

            {

                _dicltemMap.Remove(keys[i]);

            }

}

注:item是封装的类,也可以是int、string等参数……

05-28 00:39