草庐IT

ColorIndexHolder

全部标签

c# - 打破 parallel.foreach?

我如何突破parallel.for循环?我有一个非常复杂的语句,如下所示:Parallel.ForEach(ColorIndex.AsEnumerable(),newAction((ColorIndexHolderElement)=>{if(Element.StartIndex=I){Found=true;break;}}));使用并行类,我可以优化这个过程。然而;我不知道如何打破并行循环?break;语句抛出以下语法错误:Noenclosingloopsoutofwhichtobreakorcontinue 最佳答案 使用Para

c# - 打破 parallel.foreach?

我如何突破parallel.for循环?我有一个非常复杂的语句,如下所示:Parallel.ForEach(ColorIndex.AsEnumerable(),newAction((ColorIndexHolderElement)=>{if(Element.StartIndex=I){Found=true;break;}}));使用并行类,我可以优化这个过程。然而;我不知道如何打破并行循环?break;语句抛出以下语法错误:Noenclosingloopsoutofwhichtobreakorcontinue 最佳答案 使用Para