According to Microsoft Doc, the SortedDictionary.GetEnumerator() method is an O(log n) operation in C#. SortedDictionary is backed by SortedSet. Looking at .NET source line 1911 to 1923, when the GetEnumerator() method is called, a new Enumerator is instantiated which creates a Stack<T> internally. Then the Stack<T> is filled in in the Initialize() method. This is an O(n) operation, not O(log n)!
I'd appreciate it if someone explains the reason for O(log n).