VB.NET and Lambda – Finding all the elements of an integer array less than 35

Here’s a sample code snippet demonstrating how to find all the elements of an integer array that is less than 35 using Lambda expression in VB.NET.

The Where keyword in VB.NET is used to filter the elements from a collection based on the specified criteria.

How to find all the elements of an integer array less than 35 using Lambda expression in VB.NET ?

Module ACConsoleApp
    Sub Main()
        Dim input As Integer() = {78, 5, 23, 67, 11, 23}
        ' find all the numbers greater than 35 using Lambda
        Dim output = input.Where(Function(a) a > 35)
        Debug.WriteLine("Numbers Greater than 35")
        For Each item As VariantType In output
            Debug.WriteLine(item)
        Next
    End Sub

End Module

Numbers Greater than 35

78

67

Leave Your Comment

Liked this content?. Please spread the word :)