由于使用了范型,操作变得相当简单
新建一个
protected Dictionary<string, ISectionControl> SectionControlDictionary = new Dictionary<string, ISectionControl>();
使用
SectionControlDictionary.Add("SectionBoard", mSectionBoardUserControl);
遍历
foreach (KeyValuePair<string, List<object>> de in SectionDictionary)
{
SectionControlDictionary[de.Key].ReBind(de.Value);
}
[separator]
HashTable
//定义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