C\#디자인 모드 의 Builder 생 성기 모드 해결 아내 가 컴퓨터 문 제 를 설정 하 는 실례
이론 적 정의
생 성기 모드 복잡 한 대상 을 단계별 로 만 들 수 있다.
2.예 를 들 어
수요 설명:월급 이 나 왔 다 고 브 로드 웨 이 를 정상 으로 가 려 고 합 니 다. 아내 에 게 컴퓨터 한 대 를 배치 하 다.
OK,BRT 를 타고 출발 합 니 다.
언덕 꼭대기 에 이 르 러 한 미녀 가 얼굴 을 향 해 다가 와 미 소 를 지 으 며:선생님,저 브랜드 가 마음 에 드 시 면 이리 와 보 세 요!
남 들 이 모두 입 을 열 었 으 니,두 터 운 정 은 거절 하기 어 려 우 니 한번 보아 라.
3.구체 적 인 코딩
1.CPU
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// CPU
/// </summary>
public class CPU
{
/// <summary>
/// CPU
/// </summary>
public string Brand { get; set; }
/// <summary>
/// CPU
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
2.메인보드메인보드
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
///
/// </summary>
public class MotherBoard
{
/// <summary>
///
/// </summary>
public string Brand { get; set; }
/// <summary>
///
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
3.메모리 바메모리 바 메모리
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// Memory
/// </summary>
public class Memory
{
/// <summary>
/// Memory
/// </summary>
public string Brand { get; set; }
/// <summary>
/// Memory
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
4.하드디스크하드디스크
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// HardDisk
/// </summary>
public class HardDisk
{
/// <summary>
/// HardDisk
/// </summary>
public string Brand { get; set; }
/// <summary>
/// HardDisk
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
5.그래 픽 카드그래 픽 카드
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// GraphicCard
/// </summary>
public class GraphicCard
{
/// <summary>
/// GraphicCard
/// </summary>
public string Brand { get; set; }
/// <summary>
/// GraphicCard
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
6.모니터모니터 디 스 플레이
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// Display
/// </summary>
public class Display
{
/// <summary>
///
/// </summary>
public string Brand { get; set; }
/// <summary>
///
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
7.스피커스피커 스피커
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// Speakers
/// </summary>
public class Speakers
{
/// <summary>
/// Speakers
/// </summary>
public string Brand { get; set; }
/// <summary>
/// Speakers
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
8.키보드키보드 키보드 키보드
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// Keyboard
/// </summary>
public class Keyboard
{
/// <summary>
/// Keyboard
/// </summary>
public string Brand { get; set; }
/// <summary>
/// Keyboard
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
9.마우스마우스 마우스
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// Mouse
/// </summary>
public class Mouse
{
/// <summary>
/// Mouse
/// </summary>
public string Brand { get; set; }
/// <summary>
/// Mouse
/// </summary>
public string SerialsName { get; set; }
// ...........
}
}
10.컴퓨터 구성 표 Config
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
public class Config
{
/// <summary>
/// CPU
/// </summary>
public CPU CPU { get; set; }
/// <summary>
///
/// </summary>
public Display Display { get; set; }
/// <summary>
///
/// </summary>
public MotherBoard MotherBoard { get; set; }
/// <summary>
///
/// </summary>
public Memory Memory { get; set; }
/// <summary>
///
/// </summary>
public HardDisk HardDisk { get; set; }
/// <summary>
///
/// </summary>
public GraphicCard GraphicCard { get; set; }
/// <summary>
///
/// </summary>
public Speakers Speakers { get; set; }
/// <summary>
///
/// </summary>
public Keyboard Keyboard { get; set; }
/// <summary>
///
/// </summary>
public Mouse Mouse { get; set; }
}
}
11.컴퓨터 한 대
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
///
/// </summary>
public class Computer
{
/// <summary>
/// CPU
/// </summary>
public CPU CPU { get; set; }
/// <summary>
///
/// </summary>
public Display Display { get; set; }
/// <summary>
///
/// </summary>
public MotherBoard MotherBoard { get; set; }
/// <summary>
///
/// </summary>
public Memory Memory { get; set; }
/// <summary>
///
/// </summary>
public HardDisk HardDisk { get; set; }
/// <summary>
///
/// </summary>
public GraphicCard GraphicCard { get; set; }
/// <summary>
///
/// </summary>
public Speakers Speakers { get; set; }
/// <summary>
///
/// </summary>
public Keyboard Keyboard { get; set; }
/// <summary>
///
/// </summary>
public Mouse Mouse { get; set; }
/// <summary>
///
/// </summary>
public Manufactures Manufactures { get; set; }
/// <summary>
///
/// </summary>
public string Serials{ get; set; }
/// <summary>
///
/// </summary>
public void ShowConfig()
{
Console.WriteLine(Manufactures +"\t"+ Serials+" :");
Console.WriteLine("--------------------------------------------------");
Console.WriteLine(" \t ");
Console.WriteLine("CPU " + CPU.Brand + "\t " + CPU.SerialsName + " ");
Console.WriteLine(" " + MotherBoard.Brand + "\t " + MotherBoard.SerialsName + " ");
Console.WriteLine(" " + Memory.Brand + "\t " + Memory.SerialsName + " ");
Console.WriteLine(" " + HardDisk.Brand + "\t " + HardDisk.SerialsName + " ");
Console.WriteLine(" " + GraphicCard.Brand + "\t " + GraphicCard.SerialsName + " ");
Console.WriteLine(" " + Display.Brand + "\t " + Display.SerialsName + " ");
Console.WriteLine(" " + Speakers.Brand + "\t " + Speakers.SerialsName + " ");
Console.WriteLine(" " + Keyboard.Brand + "\t " + Keyboard.SerialsName + " ");
Console.WriteLine(" " + Mouse.Brand + "\t " + Mouse.SerialsName + " ");
Console.WriteLine(); Console.WriteLine();
}
}
}
12.특정한 브랜드 의 특정한 제품 의 구체 적 인 배치
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.Design.Gof.Builder.Factory;
namespace Com.Design.Gof.Builder
{
/// <summary>
///
/// </summary>
public class SerialsModel
{
private Config cfg = null;
/// <summary>
///
/// </summary>
/// <param name="Manufactures"></param>
/// <param name="SerialsName"></param>
public SerialsModel(Manufactures Manufactures, string SerialsName)
{
cfg= ConfigFactory.GetConfig(Manufactures, SerialsName);
}
/// <summary>
/// ,
/// </summary>
public Config Cfg
{
get { return cfg; }
}
}
}
13.컴퓨터 구성 표,XML 파일 을 읽 었 습 니 다.모두 세 개의 테스트 파일 이 있 습 니 다.ThinkPad.xml,삼 성.xml,소니.xml 을 연상 시 키 고 아래 에는 연상 만 표시 되 며 다른 첨부 파일 은 다운로드 합 니 다.
<?xml version="1.0" encoding="utf-8" ?>
<products>
<product Brand="lenovo" Serials=" IdeaCentre K330">
<config>
<cpu Brand="Intel">Intel i5 2320 </cpu>
<MotherBoard Brand=" "> H61 </MotherBoard>
<Memory Brand=" "> XXXX</Memory>
<HardDisk Brand=" "> 1TB 7200 ,SATA2</HardDisk>
<GraphicCard Brand=" "> XXXX</GraphicCard>
<Display Brand="lenovo"> XXXX</Display>
<Speakers Brand="lenovo"> XXXX</Speakers>
<Keyboard Brand="lenovo"> XXXX</Keyboard>
<Mouse Brand=" "> XXXX</Mouse>
</config>
</product>
<product Brand="ThinkPad" Serials=" Y670P-IFI">
<config>
<cpu Brand="Intel">Intel i5 2450M </cpu>
<MotherBoard Brand=" "> H61 </MotherBoard>
<Memory Brand=" "> XXXX</Memory>
<HardDisk Brand=" "> 500G XXXX</HardDisk>
<GraphicCard Brand=" "> XXXX</GraphicCard>
<Display Brand="LG">LG XXXX</Display>
<Speakers Brand=" "> XXXX</Speakers>
<Keyboard Brand=" "> XXXX</Keyboard>
<Mouse Brand=" "> XXXX</Mouse>
</config>
</product>
<product Brand="ThinkPad" Serials=" B470P-IFI">
<config>
<cpu Brand="Intel">Intel i5 2450M </cpu>
<MotherBoard Brand=" "> H61 </MotherBoard>
<Memory Brand=" "> XXXX</Memory>
<HardDisk Brand=" "> 500G XXXX</HardDisk>
<GraphicCard Brand=" "> XXXX</GraphicCard>
<Display Brand="LG">LG XXXX</Display>
<Speakers Brand=" "> XXXX</Speakers>
<Keyboard Brand=" "> XXXX</Keyboard>
<Mouse Brand=" "> XXXX</Mouse>
</config>
</product>
</products>
14.컴퓨터 프로필 을 가 져 오 는 간단 한 도구 류
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Xml.XPath;
using System.Text;
using Com.Design.Gof.Builder;
using System.Xml;
using System.IO;
namespace Com.Design.Gof.Builder.Factory
{
public class ConfigFactory
{
/// <summary>
///
/// </summary>
/// <param name="manufactures"> </param>
/// <param name="SerialName"> </param>
/// <returns></returns>
public static Config GetConfig(Manufactures manufactures, string SerialName) {
Config cfg = new Config();
// XML ,
XDocument doc = XDocument.Parse(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Builder\Data\" + manufactures + ".xml"));
XPathNavigator nav=doc.CreateNavigator();
XPathNavigator n=nav.SelectSingleNode("/products/product[@Serials='" + SerialName.Trim() + "']");
n.MoveToChild("config","");
if (n == null) {
return cfg;
}
string Brand = string.Empty, Serials = string.Empty;
//CPU
n.MoveToChild("cpu", "");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.CPU = new CPU { Brand = Brand, SerialsName = Serials };
// MotherBoard
n.MoveToNext("MotherBoard","");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.MotherBoard = new MotherBoard { Brand = Brand, SerialsName = Serials };
// Memory
n.MoveToNext("Memory", "");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.Memory = new Memory { Brand = Brand, SerialsName = Serials };
// HardDisk
n.MoveToNext("HardDisk", "");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.HardDisk = new HardDisk { Brand = Brand, SerialsName = Serials };
// GraphicCard
n.MoveToNext("GraphicCard", "");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.GraphicCard = new GraphicCard { Brand = Brand, SerialsName = Serials };
// Display
n.MoveToNext("Display", "");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.Display = new Display { Brand = Brand, SerialsName = Serials };
// Speakers
n.MoveToNext("MotherBoard", "");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.Speakers = new Speakers { Brand = Brand, SerialsName = Serials };
// Keyboard
n.MoveToNext("Keyboard", "");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.Keyboard = new Keyboard { Brand = Brand, SerialsName = Serials };
// MotherBoard
n.MoveToNext("Mouse", "");
Brand = n.GetAttribute("Brand", "");
Serials = n.Value;
cfg.Mouse = new Mouse { Brand = Brand, SerialsName = Serials };
return cfg;
}
}
}
15.하나의 인터페이스 로 컴퓨터 를 어떻게 구축 하 는 지 정의 한다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
public interface IBuilder
{
/// <summary>
/// CPU
/// </summary>
void BuilderCPU(CPU cpu);
/// <summary>
///
/// </summary>
void BuilderMotherBoard(MotherBoard motherBoard);
/// <summary>
///
/// </summary>
void BuilderDisplay(Display display);
/// <summary>
///
/// </summary>
void BuilderMemory(Memory memory);
/// <summary>
///
/// </summary>
void BuilderHardDisk(HardDisk hardDisk);
/// <summary>
///
/// </summary>
void BuilderGraphicCard(GraphicCard graphicCard);
/// <summary>
///
/// </summary>
void BuilderSpeakers(Speakers speakers);
/// <summary>
///
/// </summary>
void BuilderKeyboard(Keyboard keyboard);
/// <summary>
///
/// </summary>
void BuilderMouse(Mouse mouse);
/// <summary>
///
/// </summary>
/// <returns></returns>
Computer GetComputer();
}
}
16.연상 컴퓨터
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// ThinkPad
/// </summary>
public class ThinkPad:IBuilder
{
Computer computer = null;//
SerialsModel Serials = null;//
public ThinkPad(Manufactures Manufactures, string SerialsName)
{
computer = new Computer { Manufactures = Manufactures, Serials = SerialsName };
Serials = new SerialsModel(Manufactures, SerialsName);
}
#region
/// <summary>
/// 1. CPU
/// </summary>
/// <param name="cpu"></param>
public void BuilderCPU(CPU cpu)
{
computer.CPU = cpu;
}
/// <summary>
/// 2.
/// </summary>
/// <param name="motherBoard"></param>
public void BuilderMotherBoard(MotherBoard motherBoard)
{
computer.MotherBoard = motherBoard;
}
/// <summary>
/// 3.
/// </summary>
/// <param name="display"></param>
public void BuilderMemory(Memory memory)
{
computer.Memory = memory;
}
/// <summary>
///4.
/// </summary>
/// <param name="display"></param>
public void BuilderHardDisk(HardDisk hardDisk)
{
computer.HardDisk = hardDisk;
}
/// <summary>
/// 5.
/// </summary>
/// <param name="display"></param>
public void BuilderGraphicCard(GraphicCard graphicCard)
{
computer.GraphicCard = graphicCard;
}
/// <summary>
/// 6.
/// </summary>
/// <param name="display"></param>
public void BuilderDisplay(Display display)
{
computer.Display = display;
}
/// <summary>
/// 7.
/// </summary>
/// <param name="display"></param>
public void BuilderSpeakers(Speakers speakers)
{
computer.Speakers = speakers;
}
/// <summary>
/// 8.
/// </summary>
/// <param name="display"></param>
public void BuilderKeyboard(Keyboard keyboard)
{
computer.Keyboard = keyboard;
}
/// <summary>
/// 9.
/// </summary>
/// <param name="display"></param>
public void BuilderMouse(Mouse mouse)
{
computer.Mouse = mouse;
}
#endregion
/// <summary>
///
/// </summary>
/// <returns></returns>
public Computer GetComputer() {
// 1--CPU
BuilderCPU(Serials.Cfg.CPU);
// 2---
BuilderMotherBoard(Serials.Cfg.MotherBoard);
// 3--
BuilderMemory(Serials.Cfg.Memory);
// 4--
BuilderHardDisk(Serials.Cfg.HardDisk);
// 5--
BuilderGraphicCard(Serials.Cfg.GraphicCard);
// 6--
BuilderDisplay(Serials.Cfg.Display);
// 7--
BuilderSpeakers(Serials.Cfg.Speakers);
// 8--
BuilderKeyboard(Serials.Cfg.Keyboard);
// 9--
BuilderMouse(Serials.Cfg.Mouse);
return computer;
}
}
}
17.소니 컴퓨터Sony
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// Sony
/// </summary>
public class Sony:IBuilder
{
Computer computer = null;//
SerialsModel Serials = null;//
public Sony(Manufactures Manufactures, string SerialsName)
{
computer = new Computer { Manufactures = Manufactures, Serials = SerialsName };
Serials = new SerialsModel(Manufactures, SerialsName);
}
#region
/// <summary>
/// 1. CPU
/// </summary>
/// <param name="cpu"></param>
public void BuilderCPU(CPU cpu)
{
computer.CPU = cpu;
}
/// <summary>
/// 2.
/// </summary>
/// <param name="motherBoard"></param>
public void BuilderMotherBoard(MotherBoard motherBoard)
{
computer.MotherBoard = motherBoard;
}
/// <summary>
/// 3.
/// </summary>
/// <param name="display"></param>
public void BuilderMemory(Memory memory)
{
computer.Memory = memory;
}
/// <summary>
///4.
/// </summary>
/// <param name="display"></param>
public void BuilderHardDisk(HardDisk hardDisk)
{
computer.HardDisk = hardDisk;
}
/// <summary>
/// 5.
/// </summary>
/// <param name="display"></param>
public void BuilderGraphicCard(GraphicCard graphicCard)
{
computer.GraphicCard = graphicCard;
}
/// <summary>
/// 6.
/// </summary>
/// <param name="display"></param>
public void BuilderDisplay(Display display)
{
computer.Display = display;
}
/// <summary>
/// 7.
/// </summary>
/// <param name="display"></param>
public void BuilderSpeakers(Speakers speakers)
{
computer.Speakers = speakers;
}
/// <summary>
/// 8.
/// </summary>
/// <param name="display"></param>
public void BuilderKeyboard(Keyboard keyboard)
{
computer.Keyboard = keyboard;
}
/// <summary>
/// 9.
/// </summary>
/// <param name="display"></param>
public void BuilderMouse(Mouse mouse)
{
computer.Mouse = mouse;
}
#endregion
/// <summary>
///
/// </summary>
/// <returns></returns>
public Computer GetComputer() {
// 1--CPU
BuilderCPU(Serials.Cfg.CPU);
// 2---
BuilderMotherBoard(Serials.Cfg.MotherBoard);
// 3--
BuilderMemory(Serials.Cfg.Memory);
// 4--
BuilderHardDisk(Serials.Cfg.HardDisk);
// 5--
BuilderGraphicCard(Serials.Cfg.GraphicCard);
// 6--
BuilderDisplay(Serials.Cfg.Display);
// 7--
BuilderSpeakers(Serials.Cfg.Speakers);
// 8--
BuilderKeyboard(Serials.Cfg.Keyboard);
// 9--
BuilderMouse(Serials.Cfg.Mouse);
return computer;
}
}
}
18.삼 성 컴퓨터삼 성
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// Samsung
/// </summary>
public class Samsung:IBuilder
{
Computer computer = null;//
SerialsModel Serials = null;//
public Samsung(Manufactures Manufactures, string SerialsName)
{
computer = new Computer { Manufactures = Manufactures, Serials = SerialsName };
Serials = new SerialsModel(Manufactures, SerialsName);
}
#region
/// <summary>
/// 1. CPU
/// </summary>
/// <param name="cpu"></param>
public void BuilderCPU(CPU cpu)
{
computer.CPU = cpu;
}
/// <summary>
/// 2.
/// </summary>
/// <param name="motherBoard"></param>
public void BuilderMotherBoard(MotherBoard motherBoard)
{
computer.MotherBoard = motherBoard;
}
/// <summary>
/// 3.
/// </summary>
/// <param name="display"></param>
public void BuilderMemory(Memory memory)
{
computer.Memory = memory;
}
/// <summary>
///4.
/// </summary>
/// <param name="display"></param>
public void BuilderHardDisk(HardDisk hardDisk)
{
computer.HardDisk = hardDisk;
}
/// <summary>
/// 5.
/// </summary>
/// <param name="display"></param>
public void BuilderGraphicCard(GraphicCard graphicCard)
{
computer.GraphicCard = graphicCard;
}
/// <summary>
/// 6.
/// </summary>
/// <param name="display"></param>
public void BuilderDisplay(Display display)
{
computer.Display = display;
}
/// <summary>
/// 7.
/// </summary>
/// <param name="display"></param>
public void BuilderSpeakers(Speakers speakers)
{
computer.Speakers = speakers;
}
/// <summary>
/// 8.
/// </summary>
/// <param name="display"></param>
public void BuilderKeyboard(Keyboard keyboard)
{
computer.Keyboard = keyboard;
}
/// <summary>
/// 9.
/// </summary>
/// <param name="display"></param>
public void BuilderMouse(Mouse mouse)
{
computer.Mouse = mouse;
}
#endregion
/// <summary>
///
/// </summary>
/// <returns></returns>
public Computer GetComputer() {
// 1--CPU
BuilderCPU(Serials.Cfg.CPU);
// 2---
BuilderMotherBoard(Serials.Cfg.MotherBoard);
// 3--
BuilderMemory(Serials.Cfg.Memory);
// 4--
BuilderHardDisk(Serials.Cfg.HardDisk);
// 5--
BuilderGraphicCard(Serials.Cfg.GraphicCard);
// 6--
BuilderDisplay(Serials.Cfg.Display);
// 7--
BuilderSpeakers(Serials.Cfg.Speakers);
// 8--
BuilderKeyboard(Serials.Cfg.Keyboard);
// 9--
BuilderMouse(Serials.Cfg.Mouse);
return computer;
}
}
}
19.미녀 판매원,컴퓨터 구입 지도
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.Design.Gof.Builder
{
/// <summary>
/// ,
/// </summary>
public enum Manufactures
{
Acer =1, Alienware=2, =3,
=4, =5, =6, =7,
DCMOFA=8,ESER =9, =10,
=11,Gateway =12, =13,
=14, =15,Intel=16,
=17, =18, ThinkPad=19,
=20, LG=21, =22,
msi =23, =24,NEC=25,
=26, =27, =28,
=29, =30, =31,
=32, =33, =34,
=35, =36, =37,
TerransForce=38, =39, =40,
=41, =42
}
public class Salesman
{
/// <summary>
///
/// </summary>
public void ShowConfig()
{
Builder.GetComputer().ShowConfig();
}
/// <summary>
///
/// </summary>
public IBuilder Builder { get; set; }
}
}
20.주 함수 호출
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.Design.Gof.Builder;
namespace Com.Design.Gof.Test
{
class Program
{
static void Main(string[] args)
{
// , ? !
Salesman salesman = new Salesman();
//
salesman.Builder = new ThinkPad(Manufactures. ThinkPad, " IdeaCentre K330");
salesman.ShowConfig(); //
//
salesman.Builder = new Sony(Manufactures. , " E14A17ECW");
salesman.ShowConfig(); //
//
salesman.Builder = new Samsung(Manufactures. , " 300E4A-S0G");
salesman.ShowConfig(); //
Console.ReadKey();
}
}
}
21.실행 결과22.총결산
각 컴퓨터 부품 을 다시 세분 화 하려 고 했 는데 공사 가 많 고 컴퓨터 제품 의 속성 이 많아 서 두 필드 만 열거 했다.
첨부 파일 에는 프로그램 소스 코드 가 포함 되 어 있 습 니 다.다른 항목 의 테스트 도 포함 되 어 있 습 니 다.콘 솔 도 있 고 웹 도 있 습 니 다.
첨부:전체 인 스 턴 스 코드 는 여 기 를 클릭 하 십시오본 사이트 다운로드
더 많은 C\#관련 내용 은 본 사이트 의 주 제 를 볼 수 있다.,,,,,,
본 고 에서 말 한 것 이 여러분 의 C\#프로 그래 밍 에 도움 이 되 기 를 바 랍 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
WebView2를 Visual Studio 2017 Express에서 사용할 수 있을 때까지Evergreen .Net Framework SDK 4.8 VisualStudio2017에서 NuGet을 사용하기 때문에 패키지 관리 방법을 packages.config 대신 PackageReference를 사용해야...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.