HashTable(string , LinkedList <string> ) => Comment accéder aux données ?
Bonjour,
J'aimerais réaliser une table de hachage avec comme clé un string et comme value une LinkedList de string (dans un premier temps puis une LinkedList d'objets dans un deuxième temps).
Pour le moment je reste bloqué, voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| Hashtable HashTbleStr = new Hashtable();
LinkedList<string> ll = new LinkedList<string>();
ll.AddLast("elem01");
HashTbleStr.Add("clé", ll);
LinkedList<string> ll2 = new LinkedList<string>();
ll2.AddLast("elem02");
HashTbleStr.Add("clé2", ll2);
IDictionaryEnumerator iEnum = HashTbleStr.GetEnumerator();
while (iEnum.MoveNext())
{
MessageBox.Show(iEnum.Key + ":" + iEnum.Value);
} |
Ce qui me donne comme résultat :
clé:System.Collections.Generic.LinkedList`1[System.String]
clé2:System.Collections.Generic.LinkedList`1[System.String]
Ce que je n'arrive pas à saisir c'est que si IEnum.Value est ma liste pq je ne peux pas y accéder en faisant :
(iEnum.Value).ElementAt(0).ToString()
Dans ce cas comment faire ?
Merci d'avance
Lionel