委托异步调用 C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Remoting.Messaging; //AsyncResult需要此命名空间 using System.Threading; //Thread.Sleep(5000)需要此命名空间 namespace DelegateAsyncCall { public delegate int BinaryOp(int larg, int rarg); class Program { static void Main(string[] args) { BinaryOp b = new BinaryOp(Add); IAsyncResult ifR = b.BeginInvoke(10, 10, new AsyncCallback(AddComplete), null); //Main Thread.. 模拟主线程所操作 for (int i = 0; i < 50; i++) { Console.WriteLine("Main thread..."); } Console.Read(); } static int Add(int larg, int rarg) { try {