Beispiel #1
0
        public static IEnumerable <Tv> PopWithValue <Tk, Tv>(this Dict <Tk, Tv> dict, Tk key, Func <Tv, bool> remove)
            where Tk : IEquatable <Tk>
        {
            var values = dict.ValuesWithKey(key).ToArray();

            dict.RemoveAll(key);
            foreach (var v in values)
            {
                if (remove(v))
                {
                    yield return(v);
                }
                else
                {
                    dict.Add(KeyValuePairs.Create(key, v));
                }
            }
        }
Beispiel #2
0
 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
 {
     return(KeyValuePairs.GetEnumerator());
 }
Beispiel #3
0
 public IEnumerator <KeyValuePair <TKey, TValue> > GetEnumerator()
 {
     return(KeyValuePairs.GetEnumerator());
 }
Beispiel #4
0
 public static IEnumerable <KeyValuePair <Tk, Tv> > KeyValueParisWith <Tk, Tv>(this Dict <Tk, Tv> dict, Tk key)
     where Tk : IEquatable <Tk>
 {
     return(dict.ValuesWithKey(key).Select(v => KeyValuePairs.Create(key, v)));
 }