Is there a non-unique-key sorted list generic collection in C#?

Viewed 11147

I'm a bit surprised by System.Collections.Generic.SortedList, in that

  1. It requires me to use <key, value> instead of <value>(comparer)
  2. It only allows on entry per value

These seem quirky in the way I want to use it (although I'm sure they're just right for other situations). Is there another collection that doesn't have these two characteristics?

5 Answers

I've tried finding this same thing: basically a list that stays ordered as you add items to it. The closest I've found so far is a SortedSet from Goletas.Collections, which uses an AVL tree implementation:

http://www.goletas.com/solutions/collections/

But this class still requires that each element in the list be unique (hence "Set").

Perhaps this class could be modified to support non-unique items.

Related