C# SortedSet Add
Description
SortedSet
adds an element to the set and returns
a value that indicates if it was successfully added.
Syntax
SortedSet.Add
has the following syntax.
public bool Add(
T item
)
Parameters
SortedSet.Add
has the following parameters.
item
- The element to add to the set.
Returns
SortedSet.Add
method returns true if item is added to the set; otherwise, false.
Example
using System;/*w ww . ja v a 2 s .com*/
using System.Collections.Generic;
public class MainClass{
public static void Main(String[] argv){
SortedSet<int> evenNumbers = new SortedSet<int>();
for (int i = 0; i < 5; i++){
evenNumbers.Add(i * 2);
}
evenNumbers.Clear();
}
}