遍歷Hashtable 的幾種方法
來源:懂視網
責編:小采
時間:2020-11-27 22:45:39
遍歷Hashtable 的幾種方法
遍歷Hashtable 的幾種方法:方法一: IDictionaryEnumerator enumerator = thProduct.GetEnumerator(); while (enumerator.MoveNext()) { arrKey.Add("@"+enumerator.Key.ToString()); // Hashtable關健字 arrVal
導讀遍歷Hashtable 的幾種方法:方法一: IDictionaryEnumerator enumerator = thProduct.GetEnumerator(); while (enumerator.MoveNext()) { arrKey.Add("@"+enumerator.Key.ToString()); // Hashtable關健字 arrVal

方法一:
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());
}
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
遍歷Hashtable 的幾種方法
遍歷Hashtable 的幾種方法:方法一: IDictionaryEnumerator enumerator = thProduct.GetEnumerator(); while (enumerator.MoveNext()) { arrKey.Add("@"+enumerator.Key.ToString()); // Hashtable關健字 arrVal