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 callback As New Predicate(Of Integer)(AddressOf IsEvenNumber)
Dim evenNumbers As List(Of Integer) = list.FindAll(callback)
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
End Module
|