About This eBook by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

SortedDictionary<TKey, TValue>, and SortedList<TKey, TValue>

To keep a dictionary sorted by its key objects, both SortedDictionary<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: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required