Example #1
0
 public Computer(string name, Component motherboard, Component processor, Component ram)
 {
     this.name = name;
     this.Motherboard = motherboard;
     this.Processor = processor;
     this.Ram = ram;
 }
Example #2
0
 public Computer(string name, Component cpu = null, Component motherboard = null, Component vga = null, Component hdd = null, Component ram = null)
     : this(name)
 {
     this.Cpu = cpu;
     this.Motherboard = motherboard;
     this.Vga = vga;
     this.Hdd = hdd;
     this.Ram = ram;
 }
Example #3
0
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Console.OutputEncoding = Encoding.UTF8;

            Component processor1 = new Component("INTEL 5.5", 15341.4m, "4 GHz, 8 core");
            Component processor2 = new Component("INTEL 6", 56.4m);
            Component graphCard1 = new Component("NVIDIA 567HG", 646.4m);
            Component graphCard2 = new Component("NVIDIA 67456HG", 6846.4m, "bad @$$ video card");
            Component graphCard3 = new Component("NVIDIA 100HG", 6846.4m, "@ video card");
            Component motherboard1 = new Component("Nfsfsf", 246.4m);
            Component motherboard2 = new Component("Nfsfsadasdsf", 346.4m);

            Computer comp1 = new Computer("PC1", new List<Component> { processor1, graphCard1, motherboard2 });
            Computer comp2 = new Computer("PC2", new List<Component> { processor1, graphCard2, motherboard1 });
            Computer comp3 = new Computer("PC3", new List<Component> { processor2, graphCard3, motherboard2 });

            Computer[] computers = new Computer[]{comp3, comp2, comp1};

            Array.Sort(computers, (a, b) => a.Price.CompareTo(b.Price));

            computers.ToList().ForEach(Console.WriteLine);
        }