答案 0 :(得分:0)
你可以这样做:
foreach(KeyValuePair<string, string> kv in st[u])
{
string key = kv.Key;
string val = kv.Value;
//Business logic here
}
答案 1 :(得分:0)
您可以尝试使用KeyValuePair
从数组中获取密钥和值。
foreach(KeyValuePair<string, string> kvp in m)
{
Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value);
}
答案 2 :(得分: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