示例#1
0
    private static void FindByProducerMethod(string input, ProductCollection colection)
    {
        int index;
        IEnumerable <Product> product;

        index = input.IndexOf(' ');
        var findProducer = input.Substring(index + 1);

        product = colection.FindProductsByProducer(findProducer);

        if (!product.Any())
        {
            Console.WriteLine("No products found");
        }
        else
        {
            foreach (var item in product)
            {
                Console.Write("{");
                Console.Write("{0};{1};{2:f2}", item.Name, item.Producer, item.Price);
                Console.WriteLine("}");
            }
        }
    }