Beispiel #1
0
        static void Main()
        {
            Console.WriteLine("Populating bag.");
            var orderedBag = new OrderedBag <Product>();
            var rand       = new RandomGenerator();

            for (int i = 0; i < ProductsCount; i++)
            {
                orderedBag.Add(rand.GetRandomProduct());
                if (i % 1000 == 0)
                {
                    Console.Write(".");
                }
            }

            Console.WriteLine("\nSearching for products.");
            for (int i = 0; i < PriceSearchCount; i++)
            {
                var result = orderedBag.FindProductsByPrice(50, 100);
                Console.WriteLine($"Search {i} finished.");
            }

            Console.WriteLine("\nSample search result:");
            orderedBag.FindProductsByPrice(50, 100).ForEach(Console.WriteLine);
        }