void Removeltems(Dictionary<key, ltem> _dicltemMap, ltem _item) { List<key> keys = new List<key>(); 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等参数……