C# associative array

后端 未结 10 2150
时光取名叫无心
时光取名叫无心 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 00:50

    Use the KeyedCollection

    Its underlying base is a List but provides a dictionary lookup based on key. In this case your key is the strings. So as long as you aren't adding the same key twice you are fine.

    http://msdn.microsoft.com/en-us/library/ms132438.aspx

提交回复
热议问题