Beispiel #1
0
        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);
        }