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