Imports System.Delegate
Imports System.Threading
Delegate Function BinaryOp(ByVal arg1 As Integer, ByVal arg2 As Integer) As Integer
Module Module1
Sub Main()
Dim b As BinaryOp = AddressOf Add
Dim IAR As IAsyncResult = b.BeginInvoke(10, 10, IAR, vbNull)
While IAR.IsCompleted <> True
Console.WriteLine("Main thread")
End While
Dim results As Integer = b.EndInvoke(IAR)
Console.WriteLine(results)
Console.Read()
End Sub
Public Function Add(ByVal arg1 As Integer, ByVal arg2 As Integer) As Integer
Thread.Sleep(3000)
Return arg1 + arg2
End Function
End Module
来源:https://www.cnblogs.com/qixue/archive/2009/10/15/1583645.html