C# HashSet IsProperSupersetOf
Description
HashSet
determines whether
a HashSet
Syntax
HashSet.IsProperSupersetOf
has the following syntax.
public bool IsProperSupersetOf(
IEnumerable<T> other
)
Parameters
HashSet.IsProperSupersetOf
has the following parameters.
other
- The collection to compare to the current HashSetobject.
Returns
HashSet.IsProperSupersetOf
method returns true if the
HashSet object is a proper superset of other; otherwise, false.
Example
using System;/*from w ww . j a v a 2 s. c om*/
using System.Collections.Generic;
public class MainClass{
public static void Main(String[] argv){
HashSet<int> lowNumbers = new HashSet<int>();
HashSet<int> allNumbers = new HashSet<int>();
for (int i = 1; i < 5; i++)
{
lowNumbers.Add(i);
}
for (int i = 0; i < 10; i++)
{
allNumbers.Add(i);
}
Console.WriteLine(lowNumbers.IsProperSupersetOf(allNumbers));
}
}
The code above generates the following result.