我有以下代码
var myResponse = new Response();
Parallel
.ForEach(itemsListDto
, new ParallelOptions { MaxDegreeOfParallelism = 10 }
, itemDto => {
var tResponse = _itemService
.InsertItem
(itemDto
, new RequestMessage
{UserName = RequestUserName});
myResponse.AddErrors(tResponse.Errors);
}
);
return myResponse;
似乎myResponse
并没有将所有内容都Errors
添加到其中。我应该如何重写它以确保安全?