Check if a HashSet is a proper subset of the specified collection in CSharp
Description
The following code shows how to check if a HashSet is a proper subset of the specified collection.
Example
using System;//from w ww. jav a 2 s. c o m
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.IsProperSubsetOf(allNumbers));
}
}
The code above generates the following result.