How to create an intersection of a HashSet and a List in VB.NET

1 Answer

0 votes
Imports System
Imports System.Collections.Generic

Public Class Program
    Public Shared Sub Main(ByVal args As String())
        Dim hset As HashSet(Of String) = New HashSet(Of String) From {
            "c#",
            "vb.net",
            "c",
            "python",
            "java",
            "c++",
            "go",
            "php"
        }
        Dim list As List(Of String) = New List(Of String) From {
            "vb.net",
            "c",
            "c++",
            "javascript",
            "node.js"
        }
        
		hset.IntersectWith(list)
		
        Console.WriteLine(String.Join(" ", hset))
    End Sub
End Class




' run:
'
' vb.net c c++
'

 



answered Aug 2, 2022 by avibootz

Related questions

2 answers 152 views
2 answers 228 views
1 answer 126 views
126 views asked Mar 9, 2023 by avibootz
...