SortedDictionary<TKey, TValue> and
To keep a dictionary sorted by its key objects, both So
rtedDictionary<TKey, TValue> and
SortedList<TKey, TValue> can be used. They differ in the performance profile of various operations like insertion and deletion, as well as memory consumption. Both use a binary search tree on the inside to make retrieval an O(log n) efficient operation. For more details on the precise differences between both types on the performance front, refer to the MSDN documentation.
The interface of both types is identical to that of the
Dictionary<TKey, TValue> type simply because they all implement the corresponding generic dictionary interface. The only difference lies in the ordered characteristic of keys: ...