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等参数……

posted on 2018-10-25 19:18  _萧朗  阅读(3624)  评论(2编辑  收藏  举报