示例#1
0
 static void IterateForOnArrayWithoutCountOptimization(LoopObject[] array)
 {
     for (var i = 0; i < array.Length; i++)
     {
         LoopObject j = array[i];
     }
 }
示例#2
0
 static void IterateForeachOnArray(LoopObject[] array)
 {
     foreach (var i in array)
     {
         LoopObject j = i;
     }
 }
示例#3
0
 static void IterateForOnListWithoutCountOptimization(List <LoopObject> list)
 {
     for (var i = 0; i < list.Count; i++)
     {
         LoopObject j = list[i];
     }
 }
示例#4
0
 static void IterateForeachOnList(List <LoopObject> list)
 {
     foreach (var i in list)
     {
         LoopObject j = i;
     }
 }
示例#5
0
        static void IterateParallelForOnArrayWithCountOptimization(LoopObject[] array)
        {
            int count = array.Count();

            Parallel.For(0, count, i => { LoopObject j = array[i]; });
        }
示例#6
0
 static void IterateParallelForOnArrayWithoutCountOptimization(LoopObject[] array)
 {
     Parallel.For(0, array.Count(), i => { LoopObject j = array[i]; });
 }
示例#7
0
 static void IterateParallelForeachOnArray(LoopObject[] array)
 {
     Parallel.ForEach(array, i => { LoopObject j = i; });
 }
示例#8
0
        static void IterateParallelForOnListWithCountOptimization(List <LoopObject> list)
        {
            int count = list.Count();

            Parallel.For(0, count, i => { LoopObject j = list[i]; });
        }
示例#9
0
 static void IterateParallelForOnListWithoutCountOptimization(List <LoopObject> list)
 {
     Parallel.For(0, list.Count(), i => { LoopObject j = list[i]; });
 }
示例#10
0
 static void IterateParallelForeachOnList(List <LoopObject> list)
 {
     Parallel.ForEach(list, i => { LoopObject j = i; });
 }