static void ToNewArray(ProductsContainer NewMilk, ProductsContainer NewLeafyVegetable,
                        ProductsContainer NewFruitVegetable, ProductsContainer Products)
 {               // iš vieno mišraus produktų masyvo sukuria 3 masyvus pagal produkto tipą
     for (int i = 0; i < Products.n; i++)
     {
         Product currentProduct = Products.ProductsArray[i];
         if (currentProduct is Milk)
         {
             Milk currentMilk = (Milk)currentProduct;
             if (currentMilk.Condition())
             {
                 NewMilk.AddProduct(currentProduct as Milk);
             }
         }
         else if (currentProduct is LeafyVegetable)
         {
             if (currentProduct.weight < 1)
             {
                 NewLeafyVegetable.AddProduct(currentProduct as LeafyVegetable);
             }
         }
         else if (currentProduct is FruitVegetable)
         {
             FruitVegetable currentFruit = (FruitVegetable)currentProduct;
             if (currentFruit.Condition())
             {
                 NewFruitVegetable.AddProduct(currentProduct as FruitVegetable);
             }
         }
     }
 }
        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);
                    }
                }
            }
        }