Ejemplo n.º 1
0
        public static IMultikeyedDictionary <TKey2, TKey3, TValue> FilterToDictionary <TKey1, TKey2, TKey3, TValue>(this IMultikeyedDictionary <TKey1, TKey2, TKey3, TValue> dict, TKey1 key1Filter)
        {
            var result = new MultikeyedDictionary <TKey2, TKey3, TValue>();

            foreach (var ksvp in dict.Filter(key1Filter))
            {
                result.Add(ksvp.Keys.Key2, ksvp.Keys.Key3, ksvp.Value);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static IMultikeyedDictionary <TKey1, TKey2, TValue> ToDictionary <T, TKey1, TKey2, TValue>(this IEnumerable <T> series, Func <T, TKey1> key1Selector, Func <T, TKey2> key2Selector, Func <T, TValue> valueSelector)
        {
            MultikeyedDictionary <TKey1, TKey2, TValue> result = new MultikeyedDictionary <TKey1, TKey2, TValue>();

            foreach (var element in series)
            {
                result.Add(key1Selector(element), key2Selector(element), valueSelector(element));
            }
            return(result);
        }