方法一:
IDictionaryEnumerator enumerator = thProduct.GetEnumerator();
while (enumerator.MoveNext())
{
arrKey.Add("@"+enumerator.Key.ToString()); // Hashtable关健字
arrValue.Add(enumerator.Value.ToString()); // Hashtable值
}
方法二:
using System.Collections;
HashTable objHasTab;
// Setting values to objHasTab
foreach (DictionaryEntry objDE in objHasTab)
{
Console.WriteLine(objDE.Key.ToString());
Console.WriteLine(objDE.Value.ToString());
}
时间: 2024-10-07 13:10:17