【发布时间】:2014-05-24 09:00:34
【问题描述】:
当我在 Hashtable 中有这个结构时,如何从 SortedList 中读取值?
下面是例子
public SortedList sl = new SortedList();
sl[test] = 1;
Hashtable ht= new Hashtable();
ht.Add("root", sl);
我想阅读sl[test]。
【问题讨论】:
-
我可能会建议使用 SortedList 的通用版本:
SortedList<TKey, TValue>而不是使用Dictionary<TKey, TValue>的 HashTable(尽管字典不是 HashTable 的 1:1 替换)以避免多余的装箱/拆箱价值观
标签: c# hashtable sortedlist