两种方法:
1.DictionaryEntry
Hashtable的遍历foreach( DictionaryEntry de in hashTable) 

 console.WriteLine(
"Key -- {0}; Value --{1}.", de.Key, de.Value); 
}
 
Hashtable的遍历

2.IDictionaryEnumerator
Hashtable food = new Hashtable();
IDictionaryEnumerator myEnumerator  
= food.GetEnumerator();
while(myEnumerator.MoveNext())
{
      strfoodlist 
= strfoodlist + "\n\n" + myEnumerator.Key.ToString();
      strfoodlist 
= strfoodlist + ":\t" +myEnumerator.Value.ToString();
}

相关文章: