class tt { public int value; public override string ToString() { return value.ToString(); } }
tt t1=new tt();
t1.value = 533; Hashtable ha = new Hashtable(); ha["xiaoming"] = 56; ha[34] = t1;//可以赋值为类的对象 ha["xiaoli"] = "lili"; ha[23] = "lili"; foreach (DictionaryEntry d in ha) { Console.WriteLine("{0} {1}",d.Key,d.Value); } Console.WriteLine(ha["xiaoming"]); Console.WriteLine(ha["xiaoli"]); Console.WriteLine(ha[4]);//没有这个,输出空值 Console.WriteLine(ha[23]);新闻热点
疑难解答