2017-10-11 126 views

回答

0

你可以這樣做:

foreach(KeyValuePair<string, string> kv in st[u]) 
{ 
    string key = kv.Key; 
    string val = kv.Value; 
    //Business logic here 
} 
+0

我很確定這是我的錯。 – 2017-10-11 05:31:57

0

您可以用KeyValuePair嘗試獲得鍵和數組中的值。

foreach(KeyValuePair<string, string> kvp in m) 
{ 
Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); 

} 
+0

你缺少一個空間。 – 2017-10-11 05:29:51

+0

@someone但在OP圖像中有數組列表。不可hastable? –

+1

是的,這就是我解決我的評論的原因。 – 2017-10-11 05:31:37

0
Hashtable hashtable = new Hashtable(); 
    hashtable[1] = "One"; 
    hashtable[2] = "Two"; 
    hashtable[13] = "Thirteen"; 

    foreach (DictionaryEntry entry in hashtable) 
    { 
     Console.WriteLine("{0}, {1}", entry.Key, entry.Value); 
    } 
You can use hashtable like this 
相關問題