If you're using .NET 4.0 or later:
In the case where you need sorting then use SortedSet<T>
. Otherwise if you don't, then use HashSet<T>
since it's O(1)
for search and manipulate operations. Whereas SortedSet<T>
is O(log n)
for search and manipulate operations.