What is the need of OrderedDictionary, ListDictionary, and HybridDictionary?`
To complement Kyle's answer:
OrderedDictionary allows retrieval by key and index (it uses a hashtable and and array internally) but has a bigger overhead per item
ListDictionary has a linked list as its internal structure, it does not perform well for insertion and retrieval by key but preserves the original insert order
HybridDictionary is a ListDictionary if the dictionary does not contain many items and converts to a Hashtable if the number of items reaches a speficic limit (I personally think you should use Dictionary<,> instead of it since C#2)
In a nutshell:
Dictionary
- Well, a dictionary.ListDictionary
- Used for small collections, typically less than 10 itemsHybridDictionary
- Used when the collection size is unknown (switches implementations depending on the size of the collection)OrderedDictionary
- The elements of an OrderedDictionary are not sorted by the key, unlike the elements of aSortedDictionary<TKey, TValue>
class. You can access elements either by the key or by the index.