Sorted Set is the preferred data structure when we want to have sorted items and also to eliminate duplicate elements. Unfortunately, its performance is worse than that of a Hash Set or a Dictionary. The following program declares a new Sorted Set and adds elements to it: