}
SortedList ha = new SortedList(); tt t1 = new tt(); t1.value = 533; ha[5.5] = 56; ha[3.4] = t1;//可以赋值为类的对象 ha[7.5] = "lili"; ha[4.5] = "lili"; ha[3.0] = "lili";//输出结果是根据键的内容进行排序的,而且同一个对象键的类型只能为同一种,如只有int,只有double.或者只有string等,混用会报错 foreach (DictionaryEntry d in ha) { Console.WriteLine("{0} {1}", d.Key, d.Value); }
新闻热点
疑难解答