Module Module1
Sub Main()
Dim arr() As Integer = New Integer() {1, 2, 3, 4, 5}
' action = delegate for ShowCalc method
Dim action As New Action(Of Integer)(AddressOf ShowCalc)
Array.ForEach(arr, action)
End Sub
Private Sub ShowCalc(n As Integer)
Console.WriteLine("{0:d} calc = {1:d}", n, n * n)
End Sub
End Module
' run:
'
' 1 calc = 1
' 2 calc = 4
' 3 calc = 9
' 4 calc = 16
' 5 calc = 25