C# associative array

后端 未结 10 2164
时光取名叫无心
时光取名叫无心 2020-12-11 00:12

I\'ve been using a Hashtable, but by nature, hashtables are not ordered, and I need to keep everything in order as I add them (because I want to pull them out in the same or

10条回答
  •  甜味超标
    2020-12-11 01:01

    use sorted list i think it will solve your problem becuase SortedList object internally maintains two arrays to store the elements of the list; that is, one array for the keys and another array for the associated values. Each element is a key/value pair that can be accessed as a DictionaryEntry object

    SortedList sl = new SortedList();

    foreach(DictionaryEntry x in sl) {}

提交回复
热议问题