Hashtable类

Hashtable  属于集合 System.Collections 

用于关联数据存储 (比如电话本的人名和电话号)

常用属性 count  Keys  Values       方法 Add GetEnumerator   Remove



Exp: 

       private Hashtable _hashtable = new Hashtable();


 1
       try
 2             {
 3                 _hashtable.Add(this.txtKey.Text.ToString(), txtValue.Text.ToString());
 4             }
 5             catch(ArgumentException)
 6             {
 7                 MessageBox.Show("不能添加重复key!");
 8                 return;
 9             }
10             catch (System.Exception eX)
11             {
12                 MessageBox.Show("System wrong!");
13                 Application.Exit();
14             }
posted @ 2008-10-13 00:43  Edward Xie  阅读(136)  评论(0编辑  收藏  举报