C# SortedSet GetViewBetween
Description
SortedSet
returns a view of a
subset in a SortedSet
Syntax
SortedSet.GetViewBetween
has the following syntax.
public virtual SortedSet<T> GetViewBetween(
T lowerValue,
T upperValue
)
Parameters
SortedSet.GetViewBetween
has the following parameters.
lowerValue
- The lowest desired value in the view.upperValue
- The highest desired value in the view.
Returns
SortedSet.GetViewBetween
method returns <
Example
using System;/* w w w . j a v a2s.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("c");
set1.Add("d");
SortedSet<string> set2 = set1.GetViewBetween("a","c");
foreach (string s in set2)
{
Console.WriteLine(s);
}
}
}
The code above generates the following result.