public static void Main()
Func<int, int, int> funcDelegate = (int num1, int num2) =>
Console.WriteLine($"Test method begins in thread {Thread.CurrentThread.ManagedThreadId}");
Thread.Sleep(TimeSpan.FromSeconds(3));
IAsyncResult asyncResult = funcDelegate.BeginInvoke(30, 20, null, null);
Console.WriteLine($"Main thread {Thread.CurrentThread.ManagedThreadId} does some work.\n");
while (!asyncResult.IsCompleted)
int result = funcDelegate.EndInvoke(asyncResult);
Console.WriteLine($"\nDoWork(30, 20) returned {result}");