C# SortedSet Remove
Description
SortedSet
removes a specified item from
the SortedSet
Syntax
SortedSet.Remove
has the following syntax.
public bool Remove(
T item
)
Parameters
SortedSet.Remove
has the following parameters.
item
- The element to remove.
Returns
SortedSet.Remove
method returns true if the element is
found and successfully removed; otherwise, false.
Example
using System;/*from www . j a v a 2 s . c o m*/
using System.Collections;
using System.Collections.Generic;
using System.IO;
class Program
{
static void Main(string[] args)
{
SortedSet<string> set1 = new SortedSet<string>();
set1.Add("a");
set1.Add("b");
set1.Add("d");
set1.Add("d");
set1.Remove("a");
foreach (string s in set1)
{
Console.WriteLine(s);
}
}
}
The code above generates the following result.