C# SortedSet SortedSet(IComparer)

Description

SortedSet SortedSet (IComparer ) initializes a new instance of the SortedSet class that uses a specified comparer.

Syntax


public SortedSet(
  IComparer<T> comparer
)

Parameters

  • comparer - The default comparer to use for comparing objects.

Example


//  w  w  w . j  a v  a  2s .c  om
using System;
using System.Collections.Generic;
public class MainClass {
    public static void Main() {

        SortedSet<String> s = new SortedSet<string>(new My());
    }
}
public class My : IComparer<string>
{
    public int Compare(string x, string y)
    {
        return 1;
    }
}




















Home »
  C# Tutorial »
    System.Collections.Generic »




HashSet
LinkedList
LinkedListNode
List
Queue
SortedSet
Stack