static void IterateForOnArrayWithoutCountOptimization(LoopObject[] array) { for (var i = 0; i < array.Length; i++) { LoopObject j = array[i]; } }
static void IterateForeachOnArray(LoopObject[] array) { foreach (var i in array) { LoopObject j = i; } }
static void IterateForOnListWithoutCountOptimization(List <LoopObject> list) { for (var i = 0; i < list.Count; i++) { LoopObject j = list[i]; } }
static void IterateForeachOnList(List <LoopObject> list) { foreach (var i in list) { LoopObject j = i; } }
static void IterateParallelForOnArrayWithCountOptimization(LoopObject[] array) { int count = array.Count(); Parallel.For(0, count, i => { LoopObject j = array[i]; }); }
static void IterateParallelForOnArrayWithoutCountOptimization(LoopObject[] array) { Parallel.For(0, array.Count(), i => { LoopObject j = array[i]; }); }
static void IterateParallelForeachOnArray(LoopObject[] array) { Parallel.ForEach(array, i => { LoopObject j = i; }); }
static void IterateParallelForOnListWithCountOptimization(List <LoopObject> list) { int count = list.Count(); Parallel.For(0, count, i => { LoopObject j = list[i]; }); }
static void IterateParallelForOnListWithoutCountOptimization(List <LoopObject> list) { Parallel.For(0, list.Count(), i => { LoopObject j = list[i]; }); }
static void IterateParallelForeachOnList(List <LoopObject> list) { Parallel.ForEach(list, i => { LoopObject j = i; }); }