VB.net Program to Demonstrate the Linq Query With an Extension Method

You are currently viewing VB.net Program to Demonstrate the Linq Query With an Extension Method

VB.Net program to demonstrate the LINQ query with an extension method

'VB.NET program to demonstrate the LINQ query 
'with an extension method.

Imports System
Imports System.IO
Imports System.Linq

Module Module1
    Sub Main()
        Dim intVals() As Integer = {50, 20, 40, 35, 10, 27, 60}

        Dim result = (From n In intVals
                      Order By n).Take(3)

        Console.WriteLine("Result: ")
        For Each val As Integer In result
            Console.Write(val & " ")
        Next
        Console.WriteLine()
    End Sub
End Module
Result:
10 20 27
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