C# 并行循环导致数据丢失

C# 并行循环导致数据丢失,c#,asp.net,web-services,C#,Asp.net,Web Services,我需要连接到一个不接受列表的web服务,因此我必须为请求实现一个循环 但是正常的for循环太长,所以我使用了并行循环 Parallel.For(0, myList.Count, (index) => { customClass customClass = new customClass(); customClass.Results = callWebservice(myList[index].data); tempHolder

我需要连接到一个不接受列表的web服务,因此我必须为请求实现一个循环

但是正常的for循环太长,所以我使用了并行循环

    Parallel.For(0, myList.Count, (index) =>
    {
        customClass customClass = new customClass();
        customClass.Results = callWebservice(myList[index].data);
        tempHolder.Add(customClass);
    });

与普通循环相比,这要快得多,但它在随机结果中返回null,为什么会发生这种情况?一次发送太多请求导致web服务阻塞

不可能知道为什么“返回null”。
callWebservice
中发生了什么?当web服务将“to busy”结果转换为
null
时,您可能正在接受异常?另外,
tempHolder.Add(customClass)
不是线程安全的,因此这可能也是问题的一部分。mm谢谢,我将研究线程安全部分