List<Task> taskList = new List<Task>();
taskList.Add(Task.Run(() =>
{
var firstFieldValues = Services.BillManageService.GetAllFeeFieldValuesByUpload(firstBillModel);
MergeDictionary(feeFieldValues, firstFieldValues);
}));
taskList.Add(Task.Run(() =>
{
var secondFieldValues = Services.BillManageService.GetAllFeeFieldValuesByUpload(secondBillModel);
MergeDictionary(feeFieldValues, secondFieldValues);
}));
taskList.Add(Task.Run(() =>
{
var thirdFieldValues = Services.BillManageService.GetAllFeeFieldValuesByUpload(thirdBillModel);
MergeDictionary(feeFieldValues, thirdFieldValues);
}));
//等待结束
Task.WaitAll(taskList.ToArray());
taskCheckFeeList.Add(Task.Run(() =>
{
CheckMergeBillFee(newBills, billFees, userId, userName, now, updateBills,
updateBillFees, feeNameIdList, delegateModels, feeNodeConditionList, feeFieldValues, secondUploadCheckModel);
}));
taskCheckFeeList.Add(Task.Run(() =>
{
CheckMergeBillFee(newBills, billFees, userId, userName, now, updateBills,
updateBillFees, feeNameIdList, delegateModels, feeNodeConditionList, feeFieldValues, thirdUploadCheckModel);
}));
//等待结束
Task.WaitAll(taskCheckFeeList.ToArray());
C#多线程处理
最新推荐文章于 2024-11-01 12:32:10 发布