C# | Get the minimum value in the SortedSet Last Updated : 01 Feb, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report SortedSet class represents the collection of objects in sorted order. This class comes under the System.Collections.Generic namespace. SortedSet<T>.Min Property is used to get minimum value in the SortedSet<T>, as defined by the comparer. Properties: In C#, SortedSet class can be used to store, remove or view elements. It maintains ascending order and does not store duplicate elements. It is suggested to use SortedSet class if you have to store unique elements and maintain ascending order. Syntax: mySet.Min Here, mySet is the object of the SortedSet. Return Value: Minimum value in the SortedSet. Below programs illustrate the use of SortedSet<T>.Min Property: Example 1: CSHARP // C# code to get the minimum value // in the SortedSet using System; using System.Collections.Generic; class GFG { // Driver code public static void Main() { // Creating a SortedSet of integers SortedSet<int> mySet = new SortedSet<int>(); // Inserting elements into SortedSet for (int i = 0; i < 10; i++) { mySet.Add(i); } // Displaying the minimum value in the SortedSet Console.WriteLine("The minimum element in SortedSet is : " + mySet.Min); } } Output: The minimum element in SortedSet is : 0 Example 2: CSHARP // C# code to get the minimum value // in the SortedSet using System; using System.Collections.Generic; class GFG { // Driver code public static void Main() { // Creating a SortedSet of strings SortedSet<string> mySet = new SortedSet<string>(); // Inserting elements into SortedSet mySet.Add("A"); mySet.Add("B"); mySet.Add("C"); mySet.Add("D"); mySet.Add("E"); mySet.Add("F"); // Displaying the minimum value in the SortedSet Console.WriteLine("The minimum element in SortedSet is : " + mySet.Min); } } Output: The minimum element in SortedSet is : A Reference: https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.sortedset-1.min?view=netcore-2.1 Comment More infoAdvertise with us Next Article C# | Get the minimum value in the SortedSet S Sahil_Bansall Follow Improve Article Tags : Misc C# CSharp-Generic-SortedSet CSharp-Generic-Namespace Practice Tags : Misc Similar Reads C# | Get the maximum value in the SortedSet SortedSet class represents the collection of objects in sorted order. This class comes under the System.Collections.Generic namespace. SortedSet<T>.Max Property is used to get the maximum value in the SortedSet which is defined by the comparer. Properties: In C#, SortedSet class can be used to st 2 min read C# | Get the number of elements in the SortedSet SortedSet class represents the collection of objects in sorted order. This class comes under the System.Collections.Generic namespace. SortedSet<T>.Count Property is used to get the number of elements in the SortedSet. Properties: In C#, SortedSet class can be used to store, remove or view elemen 2 min read C# | How to get a subset in a SortedSet SortedSet class represents the collection of objects in sorted order. This class comes under the System.Collections.Generic namespace. SortedSet<T>.GetViewBetween(T, T) method is used to return a view of a subset in a SortedSet<T>. Properties: In C#, SortedSet class can be used to store, remov 2 min read C# | Check if the SortedSet contains a specific element SortedSet class represents the collection of objects in sorted order. This class comes under the System.Collections.Generic namespace. SortedSet<T>.Contains(T) Method is used to check if a SortedSet contains a specific element or not. Properties: In C#, SortedSet class can be used to store, remov 2 min read C# | Get an enumerator that iterates through the SortedSet SortedSet<T>.GetEnumerator Method is used to return an enumerator that iterates through the SortedSet<T>. Syntax: public System.Collections.Generic.SortedSet<T>.Enumerator GetEnumerator (); Return Value: This method returns an enumerator that iterates through the SortedSet<T> 2 min read Like