"Dictionary Types" in .Net
I used common dictionaries in C #. Such things as:
var example = new Dictionary<int, string> {
{ 0, "Test0" },
{ 1, "Test1" } };
I vaguely remember that I was told that before generics you can use Hashtable (). Basically the same thing, but without a specific type (so that type values will be put in a box, I think).
var example2 = new Hashtable {
{0, "Test0"},
{1, "Test1"} };
And there are questions like this question, why do we prefer the dictionary by Hashtables ( Why is the dictionary preferable to a hash table? ).
But what about all the other types of vocabulary ?
SortedDictionary<K,V>“It seems to work like a Dictionary, but it does.” Kayss collection is sorted. I'm not sure why you don't care.OrderedDictionary, Hashtable, , Hashtable. http://msdn.microsoft.com/en-us/library/system.collections.specialized.ordereddictionary.aspx , , SortedDictionary, , .ListDictionary- /, Hashtable ( , ?), 10. , , .
SortedList<K,V>. List, , / ( , ?). IDictionary<TKey,TValue>. , SortedDictionary ( SortedList SortedDictionary?)
- , ?
, .Net 4.5 ... , , , Hashtable ?
Dictionary<TKey,TValue>. - .
, OrderedDictionary.
, .
OrderedDictioanry childToIcecream = new OrderedDictionary();
childToIcecream["Jake"] = "Vanilla";
childToIcecream["Kevin"] = "Chocolate";
childToIcecream["Megan"] = "Strawberry";
. ( = 0, = 1..) , , . , , , . List<string> . / .
. , / , , , , .
SortedDictionary<char, string> letterToWord = new SortedDictionary<char, string>();
letterToWord['b'] = "bat";
letterToWord['c'] = "cat";
letterToWord['a'] = "apple";
, , , , . , .
TL;DR; Dictionary<TKey, TValue>, , .