如何在使用linq时将foreachloop转换为并行foreachloop?

时间:2017-10-18 08:24:29

标签: c# linq foreach parallel-foreach

问题是我还在使用linqs吗?

foreach (var item in ints.Select((x, i) => new { OldIndex = i, Value = x, NewIndex = -1 })
                .OrderBy(x => x.Value)
                .Select((x, i) => new { OldIndex = x.OldIndex, Value = x.Value, NewIndex = i })
                .OrderBy(x => x.OldIndex))
                Console.Write(item + "\n");

0 个答案:

没有答案