public static Dict <TKey, TValue> Clone <TKey, TValue>(this Dict <TKey, TValue> rDict) { var newDict = new Dict <TKey, TValue>(); foreach (var item in rDict) { newDict.Add((TKey)item.Key, (TValue)item.Value); } return(newDict); }
public static Dict <TKey, TValue> Sort <TKey, TValue>(this Dict <TKey, TValue> rDict, Comparison <CKeyValuePair <TKey, TValue> > cmpAlgo) { var list = new List <CKeyValuePair <TKey, TValue> >(); foreach (var item in rDict) { list.Add(item); } list.Sort(cmpAlgo); rDict.Clear(); for (int i = 0; i < list.Count; i++) { rDict.Add(list[i].Key, list[i].Value); } return(rDict); }
public void Add(TKey rKey, TValue rValue) { mDictionary.Add(rKey, rValue); mKeyList.Add(rKey); }