//demo1:
/*
*定義
*Properties為自定義類屬性
*/
private Dictionary<string, Properties> _dictOutItem = new Dictionary<string, Properties>();
/*
*循環取值
*/
foreach (KeyValuePair<string, Properties> o_Dic in o_aMessage.DictOutItem)
{
}
//demo2:
/*
*定義
*/
private Hashtable hash = new Hashtable();
/*
*添加數據
*/
hash.Add(A,B);
/*
*foreach 循環
*/
foreach (DictionaryEntry item in hash)
{
string stKey=item.Key.ToString();
string strValue=item.Value.ToString();
}
//demo3
/*
*定義
*/
/// <summary>
/// key:名稱,Value:名稱關聯的值
/// </summary>
private Dictionary<string, string> hash = new Dictionary<string, string>();
/// <summary>
/// 保存HashTable的值
/// </summary>
private System.Collections.IDictionaryEnumerator hashItem = null;
/*
*for 循環
*/
if (hash_Detail.Count > 0)
{
hashItem = hash.GetEnumerator();
for(int i=0;i<hash_Detail.Count;i++)
{
hashItem.MoveNext();
string stKey=hashItem.Key.ToString();
string strValue=hashItem.Value.ToString();
}
}