Is there a sorted collection type in .NET?

前端 未结 7 1653
夕颜
夕颜 2020-12-01 08:19

I\'m looking for a container that keeps all its items in order. I looked at SortedList, but that requires a separate key, and does not allow duplicate keys. I could also j

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 08:41

    If the key is also an attribute of the object, you might try the System.Collections.ObjectModel.KeyedCollection. It's an abstract class, but if your key is just a property of the item then it's real simple to derive from.

提交回复
热议问题