Dim int1() As Integer = {1,2,3,4,5} Dim int2() As Integer = {2,3,5,6} Dim lst,lst1,lst2 As New List(Of Integer) lst1.AddRange(Int1) lst2.AddRange(Int2) For Each i As Integer In lst1 If lst.Contains(i) = False Then lst.Add(i) End If For Each j As Integer In lst2 If lst.Contains(j) Then lst.Remove(j) End If If lst.Contains(j) = False AndAlso lst1.Contains(j) = False Then lst.Add(j) End If Next Next For Each i As Integer In lst Output.Show(i) Next
|