public static void loop(int begin, int end, int step, int chunk, LoopInt body) { if (!checkArgs(begin, end, step, chunk)) { throw new ArgumentException(); } var iS = Enumerable.Range(0, (end - begin) / step) .Select(i => begin + step * i); System.Threading.Tasks.Parallel.ForEach(iS, new Action <int>(body)); }
public static void loop(int end, LoopInt body) { loop(0, end, 1, 1, body); }