Parallel stepped for loops in .NET C# z
时间:2014-05-22 16:08:30
收藏:0
阅读:281
for (int i = 0; i < 20; i += 2) public IEnumerable<int> SteppedIntegerList(int startIndex, int endEndex, int stepSize) { for (int i = startIndex; i < endEndex; i += stepSize) { yield return i; } } Parallel.ForEach(SteppedIntegerList(0, 20, 2), index => { Console.WriteLine("Index value: {0}", index); });
评论(0)