怎样获取Hashtable中的key以及value并把value的值赋一个变量
RT
------解决方案--------------------var result =
from n in ht.Cast<DictionaryEntry>()
where n.Key=="X"
select n;
------解决方案--------------------Hashtable hTable =new Hashtable();
hTable.Add("key","value");
IDictionaryEnumerator mIDE = hTable.GetEnumerator();
while (mIDE.MoveNext())
{
Console.WriteLine("{0}:{1}", mIDE.Key, mIDE.Value);
}
http://hi.baidu.com/csy198811/item/93d0bd3e3c50cbdf6d15e985
------解决方案--------------------C# code
Hashtable hashTable = new Hashtable();
hashTable.Add("key1", "value1");
ArrayList keyList = new ArrayList(hashTable.Keys);
for (int i = 0; i < keyList.Count; i++)
{
hashTable[keyList[i]] = "AA";
}
Console.WriteLine(hashTable["key1"]);//AA
------解决方案--------------------
直接用啊,int value=(int)hashTable["AA"];
------解决方案--------------------