IDictionaryEnumerator IDictionary.GetEnumerator() { if (_dictionary != null) { return(_dictionary.GetEnumerator()); } #if HAVE_READ_ONLY_COLLECTIONS else if (_readOnlyDictionary != null) { return(new DictionaryEnumerator <TKey, TValue>(_readOnlyDictionary.GetEnumerator())); } #endif return(new DictionaryEnumerator <TKey, TValue>(GenericDictionary.GetEnumerator())); }
public IEnumerator <KeyValuePair <TKey, TValue> > GetEnumerator() { if (_dictionary != null) { return(_dictionary.Cast <DictionaryEntry>().Select(de => new KeyValuePair <TKey, TValue>((TKey)de.Key, (TValue)de.Value)).GetEnumerator()); } #if HAVE_READ_ONLY_COLLECTIONS else if (_readOnlyDictionary != null) { return(_readOnlyDictionary.GetEnumerator()); } #endif else { return(GenericDictionary.GetEnumerator()); } }