public delegate void ProcessHandler(Model model);//委托申明 ProcessHandler msghandler = new ProcessHandler(ProcessMsg);//實例化一個委托IAsyncResult iasyn = msgha ...
public delegate void ProcessHandler(Model model);//委托申明
ProcessHandler msghandler = new ProcessHandler(ProcessMsg);//實例化一個委托
IAsyncResult iasyn = msghandler.BeginInvoke(model, new AsyncCallback(CompleteHandler), null);//開始執行處理過程
//主處理過程結束調用的函數
static void CompleteHandler(IAsyncResult asyn)
{
AsyncResult ar = (AsyncResult)asyn;
ProcessHandler del = (ProcessHandler)ar.AsyncDelegate;
del.EndInvoke(asyn);
}
static void ProcessMsg(Model model){
//主處理過程
}