HashSet(T).IsProperSubsetOf Method tells whether a HashSet(Of T) object is a proper subset of the specified collection. : HashSet « Data Structure « VB.Net






HashSet(T).IsProperSubsetOf Method tells whether a HashSet(Of T) object is a proper subset of the specified collection.

 
Imports System
Imports System.Collections.Generic

Class Program
    Shared Sub Main()
    
        Dim lowNumbers As HashSet(Of Integer) = New HashSet(Of Integer)()
        Dim allNumbers As HashSet(Of Integer) = New HashSet(Of Integer)()
    
        For i As Integer = 1 To 4
            lowNumbers.Add(i)
        Next i
    
        For i As Integer = 0 To 9
            allNumbers.Add(i)
        Next i
    
    
        Console.WriteLine("lowNumbers overlaps allNumbers: {0}", lowNumbers.Overlaps(allNumbers))
    
        Console.WriteLine("allNumbers and lowNumbers are equal sets: {0}", allNumbers.SetEquals(lowNumbers))
    
        Console.WriteLine("lowNumbers is a subset of allNumbers: {0}", lowNumbers.IsSubsetOf(allNumbers))
        Console.WriteLine("lowNumbers is a proper subset of allNumbers: {0}", lowNumbers.IsProperSubsetOf(allNumbers))
    
    End Sub
End Class  

   
  








Related examples in the same category

1.KeyedCollection(TKey, TItem) is the abstract base class for a collection whose keys are embedded in the values.
2.Lookup(TKey, TElement) Represents a collection of keys each mapped to one or more values.
3.ReadOnlyCollection(T) Class Provides the base class for a generic read-only collection.
4.HashSet(T) Class Represents a set of values.
5.Create a HashSet from another HashSet
6.Create HashSet(Of T) class that uses the default equality comparer for the set type
7.Create HashSet(Of T) class from another collection
8.Remove element from HashSet with condition function
9.HashSet(T).Clear Method removes all elements from a HashSet(Of T) object.
10.HashSet(T).Contains Method tells whether a HashSet(Of T) object contains the specified element.
11.HashSet(T).ExceptWith Method removes all elements in the specified collection from the current HashSet(Of T) object.
12.HashSet(T).SymmetricExceptWith Method keeps elements that are present either in that object or in the specified collection, but not both.