I have Java code containing a TreeSet. I want to convert the code to C#.
Which equivalent collection can I use?
If there is none please suggest alternatives.
I have Java code containing a TreeSet. I want to convert the code to C#.
Which equivalent collection can I use?
If there is none please suggest alternatives.
That would be System.Collections.Generic.SortedSet<T>.
It does have the methods and complexity guarantees that one would expect from a balanced tree-backed data structure. You can find maximum, minimum, iterate through all elements in order, everything.
See Add to SortedSet<T> and its complexity for more on that.