Junior From PDF Collections C# Collections

What is a SortedSet<T> in C#?

SortedSet<T> is a collection that stores unique elements in sorted order.

  • Implements a self-balancing binary search tree (usually a Red-Black Tree).
  • Automatically maintains elements in ascending sorted order.
  • Provides set operations like union, intersection, and difference.

Example:

SortedSet<int> sortedSet = new SortedSet<int> { 5, 1, 3 };

sortedSet.Add(2); // Sorted order maintained: {1, 2, 3, 5}

More from C# Programming Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details