您的位置:首页 > 编程语言 > C#

Parallel stepped for loops in .NET C# z

2014-05-21 22:49 375 查看
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);
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: