Пример #1
0
        public static SortedDictionary <K, IList <T> > ToSortedDictionaryMany <T, K>(this IEnumerable <T> list,
                                                                                     Func <T, K> keyFunc)
        {
            var dict = new SortedDictionary <K, IList <T> >();

            foreach (var item in list)
            {
                dict.AddToDictionary(keyFunc(item), item);
            }
            return(dict);
        }
Пример #2
0
        public static SortedDictionary <K, IList <V> > ToSortedDictionaryMany <T, K, V>(this IList <T> list,
                                                                                        Func <T, K> keyFunc,
                                                                                        Func <T, V> valueFunc)
        {
            var dict = new SortedDictionary <K, IList <V> >();

            foreach (var item in list)
            {
                dict.AddToDictionary(keyFunc(item), valueFunc(item));
            }
            return(dict);
        }