Ejemplo n.º 1
0
        public static void BenchmarksGroup3()
        {
            var testObjects = new SampleClass2[_testSize];

            // ReSharper disable CoVariantArrayConversion
            RunBenchmark("SafeCallOnNullObject", () => SafeCallOnNullObject(testObjects));
            // ReSharper restore CoVariantArrayConversion
        }
Ejemplo n.º 2
0
        public static void BenchmarksGroup2()
        {
            var testObjects = new SampleClass2[_testSize];

            for (int i = 0; i < _testSize; ++i)
            {
                testObjects[i] = new SampleClass2();
            }
            // ReSharper disable CoVariantArrayConversion
            RunBenchmark("DuckObjectThatSupportsDirect", () => DuckObjectThatSupportsDirect(testObjects));
            RunBenchmark("DirectCastObjectThatSupportsDirect", () => DirectCastObjectThatSupportsDirect(testObjects));
            RunBenchmark("DynamicCallObjectThatSupportsDirect", () => DynamicCallObjectThatSupportsDirect(testObjects));
            RunBenchmark("SafeCallOnNonNullObject", () => SafeCallOnNonNullObject(testObjects));
            // ReSharper restore CoVariantArrayConversion
        }