Exemplo n.º 1
0
        static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("bg-BG");

            Component mboardAsus = new Motherboard("ASUS p67le", 323.52m);
            Component mboardMSI = new Motherboard("MSI Z51 Pro", 289.90m, "not bad motherboard");

            Component gf560Ti = new GraphicsCard("Nvidia GeForce GTX 560 Ti", 400m, "Pretty good video card");
            Component radR9290 = new GraphicsCard("Sapphire ATI Radeon R9 290", 800m, "4 GB own memory!");

            Component intelI5 = new Processor("Intel i5 3920", 250m);
            Component amdOptX4 = new Processor("AMD Opteron X4", 180m, "2.2 GHz per core");

            Computer compAsusRadeonIntel = new Computer("Monster Machine", new List<Component>() { mboardAsus, radR9290, intelI5 });
            Computer compNvidiaMsiAmd = new Computer("A Good PC");

            compNvidiaMsiAmd.Components.Add(mboardMSI);
            compNvidiaMsiAmd.Components.Add(gf560Ti);
            compNvidiaMsiAmd.Components.Add(amdOptX4);

            List<Computer> computers = new List<Computer>() { compAsusRadeonIntel, compNvidiaMsiAmd };

            computers.OrderBy(c=>c.Price).ToList().ForEach(c => Console.WriteLine(c.ToString()));
            
        }
Exemplo n.º 2
0
        static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("bg-BG");

            Component mcardVLC = new Motherboard("VLC", (decimal)185.98);
            Component vcardRadeon = new GraphicCard("Radeon", (decimal)102.34, "the best grafic card forever");
            Component vcardGeForce = new GraphicCard("GeForce", (decimal)154.45, "is not worth");

            Component procIntel = new Processor("Intel", (decimal)346.563, "can be better");
            Component procAMD = new Processor("AMD", (decimal)405.239, "always the best");

            Computer compAMDRadeon = new Computer("Fasty", new List<Component>() { mcardVLC, vcardRadeon, procAMD });
            Computer compIntelGeForce = new Computer("Star");
            //Console.WriteLine(compIntelGeForce);
            compIntelGeForce.Components.Add(vcardGeForce);
            compIntelGeForce.Components.Add(mcardVLC);

            List<Computer> computers = new List<Computer>() { compAMDRadeon, compIntelGeForce };

            computers.OrderBy(c => c.Price).ToList().ForEach(c => Console.WriteLine(c.ToString()));
            //computers.OrderBy(p => p.TotalPrice).ToList().ForEach(p => Console.WriteLine(p.ToString()));

        }