SortedList that just accepts IComparable <T>

I have an interface IScriptItemthat implements IComparable<IQueueItem>. In my opinion, it would be enough to have elements IComparableto sort anything. But all I can find is dictionaries, Hashtables and SortedLists, which are actually SortedTrees.

What I'm looking for is a sorted general list that IComparables accepts. I'm looking in the wrong place?

+3
source share
2 answers

There's nothing there. You have several options:

  • Use a SortedList with a dummy TValue.
  • Use a list or array and call List.Sort () or Array.Sort () if necessary.
  • .

Wintellect PowerCollections OrderedBag, - . NGenerics C5.

+3

, , SortedCollection <TValue> SortedCollection < TKey, TValue > , .

.NET 4 SortedSet<T>, , . , .

+2

Source: https://habr.com/ru/post/1712151/


All Articles