Hashtable 键值对集合
键值对集合
static void Main(string[] args) { //创建一个键值对集合对象 Hashtable ht = new Hashtable(); //键和值 ht.Add(1, "张三"); ht.Add(2, true); ht.Add(3, '男'); //每一个键keys的对应的元素item遍历一遍 foreach (var item in ht.Keys) { Console.WriteLine(ht[item]); } }
键值对集合
static void Main(string[] args) { //创建一个键值对集合对象 Hashtable ht = new Hashtable(); //键和值 ht.Add(1, "张三"); ht.Add(2, true); ht.Add(3, '男'); //每一个键keys的对应的元素item遍历一遍 foreach (var item in ht.Keys) { Console.WriteLine(ht[item]); } }