//定义Hashtable
Hashtable Info = new Hashtable()
//给Hashtable赋值
Info.Add("username","tiger");
Info.Add("email","tiger@tiger.com");
Info.Add("qq","888888");
//遍历Hashtable中的值并输出
foreach (DictionaryEntry each in Info)
{
Response.Write(each.Key.ToString() + " == " + each.Value.ToString() + "<br />");
}
//输出文字为:
username = tiger
email = tiger@tiger.com
qq = 888888
方法二
IDictionaryEnumerator enumerator = thProduct.GetEnumerator();
while (enumerator.MoveNext())
{
arrKey.Add("@"+enumerator.Key.ToString()); // Hashtable关健字
arrValue.Add(enumerator.Value.ToString()); // Hashtable值
}