VB.Net program to demonstrate the Union() LINQ extension method

You are currently viewing VB.Net program to demonstrate the Union() LINQ extension method

VB.Net program to demonstrate the Union() LINQ extension method

'VB.NET program to demonstrate the 
'Union() LINQ extension method.

Module Module1
    Sub Main()
        Dim intList1 = New List(Of Integer) From {101, 102, 103, 104, 105, 106}
        Dim intList2 = New List(Of Integer) From {201, 202, 103, 104, 205, 206}

        Dim result = intList1.Union(intList2)

        Console.WriteLine("Results:")
        For i = 0 To result.Count() - 1 Step 1
            Console.Write(result.ElementAt(i) & " ")
        Next
        Console.WriteLine()
    End Sub
End Module
Results:
101 102 103 104 105 106 201 202 205 206
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply