C# SortedSet Reverse
Description
SortedSet
returns an IEnumerable
Syntax
SortedSet.Reverse
has the following syntax.
public IEnumerable<T> Reverse()
Example
/* ww w .ja v a 2 s . c om*/
using System;
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");
SortedSet<string> set2 = new SortedSet<string>();
set2.Add("a");
set2.Add("b");
set2.Add("c");
set2.Add("d");
set1.SymmetricExceptWith(set2);
IEnumerable<String> ie = set1.Reverse();
foreach (string s in ie)
{
Console.WriteLine(s);
}
}
}
The code above generates the following result.