コード例 #1
0
        public static LaxStringDict <T> ToLaxStringDict <T>(this IEnumerable <T> collection,
                                                            Func <T, string> keySelector)
        {
            LaxStringDict <T> dict = new LaxStringDict <T>();

            foreach (T item in collection)
            {
                dict[keySelector(item)] = item;
            }
            return(dict);
        }
コード例 #2
0
        public static LaxStringDict <TValue> ToLaxStringDict <TEntry, TValue>(this IEnumerable <TEntry> collection,
                                                                              Func <TEntry, string> keySelector,
                                                                              Func <TEntry, TValue> valueSelector)
        {
            LaxStringDict <TValue> dict = new LaxStringDict <TValue>();

            foreach (TEntry item in collection)
            {
                dict[keySelector(item)] = valueSelector(item);
            }
            return(dict);
        }