Ref: http://blogs.msdn.com/kcwalina/archive/2005/09/23/Collections.aspx
Published 23 September 05 08:10 Pm | kcwalina
Please people ask how the new. NET Framework 2.0 generic collections relate to the non-generic collections we shipped before. So, here you go. The most important types are in bold font.
List <t>Is basically a better arraylist. it is optimized for speed, size, and power. use it for majority of internal implementations whenever you need to store items in a container. do not use it in public APIs.
Dictionary <tkey, tvalue>Is just a stronugly typed hashtable. Some changes were made to the hashing algorithm. The details are described here.
Collection <t>Is a much better collectionbase. use it to expose read/write collection output from public APIs. it's in system. collections. objectmodel namespace. why in a separate namespace and why such strange name? See here.
Readonlycollection <t>Is a much better readonlycollectionbase. It's in system. Collections. objectmodel namespace.
Queue <t> and stack <t> are equivalent to queue and stack.
Sortedlist <tkey, tvalue> is basically a generic version of sortedlist.
Sorteddictionary <tkey, tvalue> does not have a corresponding non-generic collection. it's similar to sortedlist and sortedlist <tkey, tvalue>, But it's implemented as a balanced tree (red-black tree ). insertions are on average much faster, but some lookups are slightly slower and memory consumption is larger.
Ienumerable <t> is just like ienumerable, but stronugly typed. One difference is that ienumerable <t> extends idisposable. The reasons are described here.
Icollection <t> seems like icollection, but it's actually a very different failed action. we found that icollection was not very useful. at the same time, we did not have an unsupported action that represented an read/write non-indexed collection. icollection <t> is such failed action and you cocould say that icollection does not have an exact corresponding peer in the generic world; ienumerable <t> is the closest.
Ilist <t> is just stronugly typed ilist. we removed the notion of isfixedsize and the reasons are described here.
Idictionary <tkey, tvalue> is roughly equivalent to idictionary.
Dictionarybase does not have a corresponding generic type. Simply implement idictionary <tkey, tvalue> if you need a custom dictionary.
Also, we added keyedcollection <tkey, titem>. it's a new collection which allows items to be indexed by both a key and an index. use it to expose collections of items that have natural "Names" (KEYS) from public APIs. you need to inherit from the collection to use it.
And finally connected people asked for linked-list. shortlist <t> was added to. NET Framework 2.0.
So here is the summary:
Non-generic similar generic type
Arraylist list <t>
Hashtable dictionary <tkey, tvalue>
Sortedlist <tkey, tvalue>
Queue queue <t>
Stack stack <t>
Ienumerable <t>
Icollection N/A (use ienumerable <t> anything that extends it)
N/A icollection <t>
Ilist <t>
Collectionbase collection <t>
Readonlycollectionbase readonlycollection <t>
Dictionarybase N/A (just implement idictionary <tkey, tvalue>
N/A sorteddictionary <tkey, tvalue>
N/A keyedcollection <tkey, titem>
N/a shortlist <t>
Let me know if you wowould like me to blog more information about any of these types.