Esempio n. 1
0
        private static void Main(string[] args)
        {
            CompoundLaptop laptop = CreateLaptop();

            Console.WriteLine($"Ноутбук {laptop.Name}:\n");

            Console.WriteLine("Чистий Composite: ");
            Console.WriteLine($"Цiнних металiв - {laptop.GetSumOfValidMetal():f2} грамiв\n");

            Console.WriteLine("Composite + Visitor: ");
            Console.WriteLine($"Цiнних металiв - {laptop.Accept(new ValidMetalVisitor()):f2} грамiв\n");


            //foreach (var item in laptop.GetItems())
            //{
            //    Console.WriteLine(item.Name);
            //}

            GetLINQPlastic(laptop);
            SerializeLaptop(@"E:\Documents\GitHub\Patterns\Laptop\xml\laptop.xml", laptop);
        }
Esempio n. 2
0
 public double Visit(CompoundLaptop compoundLaptop)
 {
     return(compoundLaptop.GetSumOfValidMetal());
 }