Breaking parallel loops in .NET C# using the Stop method z

2020-12-13 06:11

阅读:501

标签:style   blog   class   c   code   java   

soscw.com,搜素材
Listint> integers = new Listint>() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

Parallel.ForEach(integers, (int item, ParallelLoopState state) =>
{
    if (item > 5)
    {
        Console.WriteLine("Higher than 5: {0}, exiting loop.", item);
        state.Stop();
    }
    else
    {
        Console.WriteLine("Less than 5: {0}", item);
    }
});
soscw.com,搜素材

 

Breaking parallel loops in .NET C# using the Stop method z,搜素材,soscw.com

Breaking parallel loops in .NET C# using the Stop method z

标签:style   blog   class   c   code   java   

原文地址:http://www.cnblogs.com/zeroone/p/3744035.html


评论


亲,登录后才可以留言!