Esempio n. 1
0
        private static void RunSampleUsingMultiplyIndexedKeyedCollection(IEnumerable<CountryOrRegionGdpData> listOfCountryOrRegionGdpData)
        {
            MultiplyIndexedKeyedCollectionOfCountryOrRegionGdpData multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData = new MultiplyIndexedKeyedCollectionOfCountryOrRegionGdpData();

            foreach (var item in listOfCountryOrRegionGdpData)
                multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.Add(item);

            CountryOrRegionGdpData itemByCode = multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByCountryCode["SWE"];

            CountryOrRegionGdpData itemByName = multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByCountryName["Sweden"];

            IEnumerable<CountryOrRegionGdpData> itemsByHasFiveDoubled = multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasFiveDoubled[true];

            IEnumerable<CountryOrRegionGdpData> itemsByHasTenDoubled = multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasTenDoubled[true];

            IEnumerable<CountryOrRegionGdpData> itemsByHasTwentyDoubled = multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasTwentyDoubled[true];

            PrintResults("MultiplyIndexedKeyedCollection", itemByCode, itemByName, itemsByHasFiveDoubled, itemsByHasTenDoubled, itemsByHasTwentyDoubled);
        }
Esempio n. 2
0
        public BenchmarkComponentMultiplyIndexedKeyedCollection(IEnumerable <CountryOrRegionGdpData> listOfCountryOrRegionGdpData)
        {
            MultiplyIndexedKeyedCollectionOfCountryOrRegionGdpData multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData = new MultiplyIndexedKeyedCollectionOfCountryOrRegionGdpData();

            RootOperation = new CollectionBenchmarkRootOperationGroup()
            {
                Operation1 = new OperationInitialization()
                {
                    Delegate = () =>
                    {
                        foreach (var item in listOfCountryOrRegionGdpData)
                        {
                            multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.Add(item);
                        }
                    },
                },
                Operation2 = new OperationGetGdp2010ByCode()
                {
                    Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByCountryCode["SWE500"].GdpYear2010.Value
                },
                Operation3 = new OperationGetGdp2010ByName()
                {
                    Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByCountryName["Sweden500"].GdpYear2010.Value,
                },
                Operation4 = new OperationGroupByIncrease()
                {
                    Operation1 = new OperationHasFiveDoubledCount()
                    {
                        Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasFiveDoubled[true].Count(),
                    },
                    Operation2 = new OperationHasTenDoubledCount()
                    {
                        Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasTenDoubled[true].Count(),
                    },
                    Operation3 = new OperationHasTwentyDoubledCount()
                    {
                        Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasTwentyDoubled[true].Count(),
                    },
                },
            };
        }
        public BenchmarkComponentMultiplyIndexedKeyedCollection(IEnumerable<CountryOrRegionGdpData> listOfCountryOrRegionGdpData)
        {
            MultiplyIndexedKeyedCollectionOfCountryOrRegionGdpData multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData = new MultiplyIndexedKeyedCollectionOfCountryOrRegionGdpData();

            RootOperation = new CollectionBenchmarkRootOperationGroup()
            {
                Operation1 = new OperationInitialization()
                {
                    Delegate = () =>
                    {
                        foreach (var item in listOfCountryOrRegionGdpData)
                            multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.Add(item);
                    },
                },
                Operation2 = new OperationGetGdp2010ByCode()
                {
                    Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByCountryCode["SWE500"].GdpYear2010.Value
                },
                Operation3 = new OperationGetGdp2010ByName()
                {
                    Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByCountryName["Sweden500"].GdpYear2010.Value,
                },
                Operation4 = new OperationGroupByIncrease()
                {
                    Operation1 = new OperationHasFiveDoubledCount()
                    {
                        Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasFiveDoubled[true].Count(),
                    },
                    Operation2 = new OperationHasTenDoubledCount()
                    {
                        Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasTenDoubled[true].Count(),
                    },
                    Operation3 = new OperationHasTwentyDoubledCount()
                    {
                        Delegate = () => multiplyIndexedKeyedCollectionOfCountryOrRegionGdpData.ByHasTwentyDoubled[true].Count(),
                    },
                },
            };
        }