Ejemplo n.º 1
0
 public static void FillDoublePlusUnitArrayWithMeters(DoublePlusUnit[] array)
 {
     for (var i = 0; i < array.Length; i++)
     {
         array[i] = new DoublePlusUnit {
             Unit = Units.Meters, Value = i
         }
     }
     ;
 }
Ejemplo n.º 2
0
        private void btnDoubleUnit_Click(object sender, EventArgs e)
        {
            benchmark("double+unit[]", sender, () =>
            {
                var list = new List <DoublePlusUnit[]>();
                for (var i = 0; i < 10; i++)
                {
                    var array = new DoublePlusUnit[100000];
                    list.Add(array);
                    for (var j = 0; j < 100; j++)
                    {
                        TestLength.FillDoublePlusUnitArrayWithMeters(array);
                    }
                }

                double sumOfAverages = 0;
                for (int i = 0; i < 30; i++)
                {
                    var average    = list.Average(array => TestLength.ConvertToMiles(array).Average());
                    sumOfAverages += average;
                }
                return(sumOfAverages);
            });
        }