public override IEnumerator <ICollection <TValue> > GetEnumerator() { using (IEnumerator <TKey> enumKeys = _myDictionary.EnumerateKeys()) { while (enumKeys.MoveNext()) { TKey key = enumKeys.Current; yield return(new ValuesForKeyCollection(_myDictionary, key)); } } }
public override IEnumerator <KeyValuePair <TKey, TValue> > GetEnumerator() { using (var enumKeys = _myDictionary.EnumerateKeys()) { while (enumKeys.MoveNext()) { var key = enumKeys.Current; IEnumerator <TValue> enumValues; if (_myDictionary.TryEnumerateValuesForKey(key, out enumValues)) { using (enumValues) { while (enumValues.MoveNext()) { yield return(new KeyValuePair <TKey, TValue>(key, enumValues.Current)); } } } } } }
public override IEnumerator <TKey> GetEnumerator() { return(_myDictionary.EnumerateKeys()); }