예제 #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));
                }
            }
        }
예제 #2
0
 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
 {
     return(KeyValuePairs.GetEnumerator());
 }
예제 #3
0
 public IEnumerator <KeyValuePair <TKey, TValue> > GetEnumerator()
 {
     return(KeyValuePairs.GetEnumerator());
 }
예제 #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)));
 }