Пример #1
0
        public static Pairs <TValue1, TValue2> ToPairs <T, TValue1, TValue2>(this IEnumerable <T> list, Func <T, TValue1> selectorValue1, Func <T, TValue2> selectorValue2)
        {
            var Pairs = new Pairs <TValue1, TValue2>();

            foreach (var element in list)
            {
                Pairs.Add(selectorValue1(element), selectorValue2(element));
            }
            return(Pairs);
        }
Пример #2
0
        public static Pairs <TKey, TValue> ToPairs <TKey, TValue>(this IEnumerable <Pair <TKey, TValue> > pairs)
        {
            var Pairs = new Pairs <TKey, TValue>();

            foreach (var pair in pairs)
            {
                Pairs.Add(pair.Value1, pair.Value2);
            }
            return(Pairs);
        }
Пример #3
0
        public static Pairs <TRValue1, TRValue2> ToPairs <TValue1, TValue2, TRValue1, TRValue2>(this IEnumerable <Pair <TValue1, TValue2> > pairs,
                                                                                                Func <TValue1, TRValue1> selectorValue1,
                                                                                                Func <TValue2, TRValue2> selectorValue2)
        {
            var Pairs = new Pairs <TRValue1, TRValue2>();

            foreach (var pair in pairs)
            {
                Pairs.Add(selectorValue1.Invoke(pair.Value1), selectorValue2.Invoke(pair.Value2));
            }
            return(Pairs);
        }
Пример #4
0
 public static Pairs <TKey, TValue> AddToPairs <TKey, TValue>(this Pairs <TKey, TValue> pairs, TKey Key, TValue Value)
 {
     pairs.Add(Key, Value);
     return(pairs);
 }
Пример #5
0
 public static Epam.JDI.Commons.Pairs.Pairs AddToPairs(this Pairs <string, string> pairs, string Key, string Value)
 {
     return(pairs.AddToPairs <string, string>(Key, Value).ToPairs());
 }