Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Enumerable Intersect produces the set intersection of two sequences

Imports System Imports System.Linq Imports System.Collections.Generic Public Class Example     Public Shared Sub Main()          Dim id1() As Integer = {4, 6, 2, 0, 1, 8}         Dim id2() As Integer = {9, 9, 3, 7, 6, 4, 0}         Dim intersection As IEnumerable(Of Integer) = id1.Intersect(id2)         For Each id As Integer In intersection             Console.WriteLine(id)         Next     End Sub End Class