diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs b/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs index 01535a3a4f5747..4eae4bba46eaef 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs @@ -245,7 +245,7 @@ public void CopyTo(KeyValuePair[] array, int index) IEnumerator> IEnumerable>.GetEnumerator() => Count == 0 ? EnumerableHelpers.GetEmptyEnumerator>() : - GetEnumerator(); + _set.GetEnumerator(); public bool Remove(TKey key) { @@ -465,10 +465,8 @@ void IEnumerator.Reset() { return new DictionaryEntry(Current.Key, Current.Value); } - else - { - return new KeyValuePair(Current.Key, Current.Value); - } + + return Current; } }