天天看点

遍历哈希表

遍历哈希表

遍历哈希表需要用到DictionaryEntry Object,代码如下:

for(DictionaryEntry de in ht) fileht为一个Hashtable实例

{ Console.WriteLine(de.Key);

de.Key对应于keyvalue键值对key   

Console.WriteLine(de.Value);

de.Key对应于keyvalue键值对value }

转载于:https://www.cnblogs.com/lucoo/archive/2012/09/04/2670596.html