hashtable的简单应用
Hashtable ht = new Hashtable();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
ht.Add("北京", "010");
ht.Add("上海", "021");
ht.Add("广州", "020");
}
private void button1_Click(object sender, EventArgs e)
{
foreach (DictionaryEntry a in ht)
{
string msg = "Key=" + a.Key.ToString() + " \tValue=" + a.Value.ToString();
this.listBox1.Items.Add(msg);
}
}
posted on 2016-08-16 16:05 LongHuaiYu 阅读(223) 评论(0) 编辑 收藏 举报