Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp4
- {
- class Program
- {
- static void Main(string[] args)
- {
- PC pc = new PcBuilder()
- .AddCPU("Ryzen 5 2600")
- .AddGPU("GTX 1060 6GB")
- .AddRAM("Crucial Ballistix Tactical 3000 MHz")
- .AddDysk("Toshiba P3000 7200 obr ")
- .AddObudowa("SilentiumPC Signum SG1")
- .Build();
- Console.ReadKey();
- }
- }
- public class PC
- {
- public string AddCPU { get; set; }
- public string AddGPU { get; set; }
- public string AddRAM { get; set; }
- public string AddObudowa { get; set; }
- public string AddDysk { get; set; }
- }
- class PcBuilder
- {
- PC pc = new PC();
- public PcBuilder AddCPU(string CPU)
- {
- pc.AddCPU = CPU;
- return this;
- }
- public PcBuilder AddGPU(string GPU)
- {
- pc.AddGPU = GPU;
- return this;
- }
- public PcBuilder AddRAM (string RAM)
- {
- pc.AddRAM = RAM;
- return this;
- }
- public PcBuilder AddObudowa(string obudowa)
- {
- pc.AddObudowa = obudowa;
- return this;
- }
- public PcBuilder AddDysk(string dysk)
- {
- pc.AddDysk = dysk;
- return this;
- }
- public PC Build()
- {
- return pc;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement