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