Imports System
Imports System.Linq
Imports System.Collections.Generic
Public Class Program
Public Shared Sub Main()
Dim arr = New Integer() {1, 2, 3, 4, 5, 6}
Dim add1 As Func(Of Integer, Integer) = Function(x) x + 1
Dim square As Func(Of Integer, Integer) = Function(x) x * x
Dim cube As Func(Of Integer, Integer) = Function(x) x * x * x
Dim functions = New List(Of Func(Of Integer, Integer)) From {
add1,
square,
cube
}
For Each fn In functions
Dim result = arr.Select(fn)
Console.WriteLine(String.Join(" ", result))
Next
End Sub
End Class
' run:
'
' 2 3 4 5 6 7
' 1 4 9 16 25 36
' 1 8 27 64 125 216
'