yzx99

导航

 

2013年10月19日

摘要: 一个类的某个属性要实现Key与Value的对应,以便通过访问名称就可以知道对应值,而不是通过索引号,最简单的方法直接用 哈希表using System.Collections;class Class1{ private Hashtable oTest = new Hashtable(); public Hashtable Test { get { return oTest; } set { oTest = value; } }}使用示例:Class1 cls = new Class1();cls.Test["XM1"] = "OK";MessageBox 阅读全文
posted @ 2013-10-19 23:49 yzx99 阅读(1510) 评论(0) 推荐(0) 编辑