diff --git a/src/System.Collections.Specialized/src/System/Collections/Specialized/OrderedDictionary.cs b/src/System.Collections.Specialized/src/System/Collections/Specialized/OrderedDictionary.cs index 1736bc4fee09..efc32cfee732 100644 --- a/src/System.Collections.Specialized/src/System/Collections/Specialized/OrderedDictionary.cs +++ b/src/System.Collections.Specialized/src/System/Collections/Specialized/OrderedDictionary.cs @@ -367,8 +367,8 @@ public void RemoveAt(int index) { throw new ArgumentOutOfRangeException(nameof(index)); } - EnsureObjectsTable(); - EnsureObjectsArray(); + // The 'index >= Count' check above ensures + // that the '_objectsArray' and '_objectsTable' objects are initialized. object key = ((DictionaryEntry)_objectsArray[index]).Key; _objectsArray.RemoveAt(index); _objectsTable.Remove(key);