我的备忘资料库

导航

 

两种方法:
1.DictionaryEntry

foreach( DictionaryEntry de in hashTable)
{
console.WriteLine(
"Key -- {0}; Value --{1}.", de.Key, de.Value);
}

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();
}

posted on 2009-10-13 14:46  四分  阅读(72)  评论(0)    收藏  举报