public bool VitaminAMore(LeafyVegetable other)
 {           // lygina "vitaminA" reikšmes rikiavimui
     if (vitaminA > other.vitaminA)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public void SortByVitaminA()
        {       // rūšiuoja pagal "vitaminA" reikšmę mažėjančia tvarka
            for (int i = 0; i < n - 1; i++)
            {
                int maxInd = i;
                for (int j = i + 1; j < n; j++)
                {
                    LeafyVegetable CurrentProduct = (LeafyVegetable)ProductsArray[j];
                    LeafyVegetable MaxProduct     = (LeafyVegetable)ProductsArray[maxInd];

                    if (CurrentProduct.VitaminAMore(MaxProduct))
                    {
                        maxInd = j;
                    }
                }
                Product temp = ProductsArray[maxInd];
                ProductsArray[maxInd] = ProductsArray[i];
                ProductsArray[i]      = temp;
            }
        }
        static void ReadProducts(string file, ProductsContainer Products)
        {               // nuskaito duomenis į vieną mišrų masyvą
            using (StreamReader reader = new StreamReader(file))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    string[] parts  = line.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    char     type   = char.Parse(parts[0]);
                    string   name   = parts[1].Trim();
                    double   price  = double.Parse(parts[2]);
                    double   weight = double.Parse(parts[3]);

                    if (type == 'p')        // pieno produktai
                    {
                        double   fatness = double.Parse(parts[4]);
                        DateTime date    = DateTime.Parse(parts[5]);

                        Product milk = new Milk(name, price, weight, fatness, date);
                        Products.AddProduct(milk);
                    }
                    else if (type == 'l')   // lapinės daržovės
                    {
                        DateTime date     = DateTime.Parse(parts[4]);
                        int      vitaminA = int.Parse(parts[5]);

                        Product leafyVegetable = new LeafyVegetable(name, price, weight, date, vitaminA);
                        Products.AddProduct(leafyVegetable);
                    }
                    else if (type == 'v')   // vaisinės daržovės
                    {
                        DateTime date      = DateTime.Parse(parts[4]);
                        int      sweetness = int.Parse(parts[5]);

                        Product fruitVegetable = new FruitVegetable(name, price, weight, date, sweetness);
                        Products.AddProduct(fruitVegetable);
                    }
                }
            }
        }