示例#1
0
        public static Pairs ToPairs(this IEnumerable <KeyValuePair <string, string> > pairs, Dictionary <string, string> dict)
        {
            var Pairs = new Pairs();

            pairs.ToPairs().ForEach(pair => Pairs.Add(dict.ContainsKey(pair.Value1) ? dict[pair.Value1] : "", pair.Value2));
            return(Pairs);
        }
示例#2
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);
        }
示例#3
0
        public static Pairs ToPairs(this List <string> pairs, char separator)
        {
            var Pairs = new Pairs();

            foreach (var splitted in pairs.Select(pair => pair.Split(separator)))
            {
                Pairs.Add(splitted[0], splitted[1]);
            }
            return(Pairs);
        }
示例#4
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);
        }
示例#5
0
        public static Pairs ToPairs(this IEnumerable <Pair <string, string> > pairs, Dictionary <string, string> dict)
        {
            var Pairs = new Pairs();

            foreach (var pair in pairs)
            {
                Pairs.Add(dict.ContainsKey(pair.Value1) ? dict[pair.Value1] : "", pair.Value2);
            }
            return(Pairs);
        }
示例#6
0
        public static Pairs ToPairs(this IEnumerable <Pair <string, string> > pairs)
        {
            var Pairs = new Pairs();

            foreach (var pair in pairs)
            {
                Pairs.Add(pair.Value1, pair.Value2);
            }
            return(Pairs);
        }
示例#7
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);
        }
示例#8
0
 public static Pairs <TKey, TValue> AddToPairs <TKey, TValue>(this Pairs <TKey, TValue> pairs, TKey Key, TValue Value)
 {
     pairs.Add(Key, Value);
     return(pairs);
 }
示例#9
0
 public static Pairs AddToPairs(this Pairs <string, string> pairs, string Key, string Value)
 {
     return(pairs.AddToPairs <string, string>(Key, Value).ToPairs());
 }