Articles → CSHARP → Sortedset In C#
Sortedset In C#
Purpose
Example
using System;
using System.Collections.Generic;
namespace SortedsetDemo
{
class Program
{
static void Main(string[] args)
{
SortedSet<int> sortedSet = new SortedSet<int>();
sortedSet.Add(3);
sortedSet.Add(2);
sortedSet.Add(5);
sortedSet.Add(1);
foreach (int element in sortedSet)
{
Console.WriteLine(element.ToString() + Environment.NewLine);
}
Console.ReadLine();
}
}
}
Output
| Posted By - | Karan Gupta |
| |
| Posted On - | Friday, January 22, 2021 |