Check if SortedSet and the specified collection contain the same elements in CSharp

Description

The following code shows how to check if SortedSet and the specified collection contain the same elements.

Example


using System;//w ww. j a va  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");
        
        SortedSet<string> set2 = new SortedSet<string>();
        set2.Add("a");
        set2.Add("b");
        set2.Add("c");
        set2.Add("d");
        
        Console.WriteLine(set1.SetEquals(set2));

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary