static void Begin1Callback(IAsyncResult result) { if (result.CompletedSynchronously) { return; } ChainedAsyncResult thisPtr = (ChainedAsyncResult)result.AsyncState; bool completeSelf = false; Exception completeException = null; try { completeSelf = thisPtr.Begin1Completed(result); } catch (Exception exception) { completeSelf = true; completeException = exception; } if (completeSelf) { thisPtr.Complete(false, completeException); } }
static void Begin2Callback(IAsyncResult result) { if (result.CompletedSynchronously) { return; } ChainedAsyncResult thisPtr = (ChainedAsyncResult)result.AsyncState; Exception completeException = null; try { thisPtr.end2(result); } catch (Exception exception) { completeException = exception; } thisPtr.Complete(false, completeException); }