Last Updated : 11 Jul, 2025
SortedSetclass represents the collection of objects in sorted order. This class comes under the
System.Collections.Genericnamespace.
SortedSet<T>.Min Propertyis used to get minimum value in the SortedSet<T>, as defined by the comparer.
Properties:mySet.Min
Here,
mySetis 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 : 0Example 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 : AReference:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4