1.1首先定义一个委托,该委托指向的方法就是要执行耗时长的操作 public delegate string mydelegate(int num);1.2定义异步完成时回调的函数:private void callBackMethod(IAsyncResult result) { /*由于已经在调用BeginInvoke传递的最后一个参数是回调委托 所以可以从操作状态中获取*/ mydelegate my = (mydelegate)result.AsyncState; //EndInvoke完成回调,并处理调用返回的结果 string temp = my.EndInvoke(result); //处理返回的结果temp字符串 MessageBox.Show("完成操作。" + temp);}