Lambda expression syntax : Lambda « LINQ « VB.Net






Lambda expression syntax

   
Option Strict On
Imports System.Collections.Generic

Module Program
  Sub Main()
    Dim list As New List(Of Integer)()
    list.AddRange(New Integer() {20, 1, 4, 8, 9, 44})
    Dim evenNumbers As List(Of Integer) = list.FindAll(Function(i As Integer) (i Mod 2) = 0)
    For Each evenNumber As Integer In evenNumbers
      Console.WriteLine(evenNumber)
    Next
  End Sub
  Function IsEvenNumber(ByVal i As Integer) As Boolean
    Return (i Mod 2) = 0
  End Function

  Sub LambdaExpressionSyntax()
  End Sub

End Module

   
    
    
  








Related examples in the same category

1.Lambda with No Args
2.Lambdas with Multiple Params
3.LINQ query with Enumerable / Lambdas
4.Use Lambda Function to wrap a query