示例#1
0
        static void Main(string[] args)
        {
            // get data before hand.

            List <TestSubClass> list = (from i in Enumerable.Range(0, 10000)
                                        select new TestSubClass {
                A = i, B = i
            }).ToList();

            TestSubClass[] arr    = list.ToArray();
            TestClass[]    vararr = arr;

            // run benchmarks.

            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;

            List <BenchmarkResult> results = new List <BenchmarkResult>();

            Benchmark(results, "list", list);
            Benchmark(results, "arr", arr);
            Benchmark(results, "vararr", vararr);

            BenchmarkResult.Write("results", results);
        }