Public Shared Function MyAdd(i As Integer, j As Integer)
Dim a As Integer
a = i + j
Return a
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim MyFunc As Func(Of Integer, Integer, Integer) = New Func(Of Integer, Integer, Integer)(AddressOf MyAdd)
Dim i = MyFunc(10, 20)
MsgBox(i)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim test As Func(Of Integer) = Function() 10
Dim result = test.Invoke()
MsgBox(result)
' Return an Integer with a String argument.
' ... Returns the string length multiplied by 2.
Dim test2 As Func(Of String, Integer) = Function(x) x.Length * 2
Dim result2 = test2.Invoke("bird")
MsgBox(result2)
End Sub