最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
C#设计模式之建造者(Builder)模式示例源代码
时间:2022-07-02 11:08:37 编辑:袖梨 来源:一聚教程网
using System;
using System.Collections;
//product
public class Computer
{
private string Type;
private Hashtable info=new Hashtable ();
public Computer(string type)
{
Type=type;
Console .WriteLine ("Conputer "+type+" is Builded!");
}
public string this[string key]
{
get
{
return (string)info[key];
}
set
{
info[key]=value;
}
}
public void Show()
{
Console .WriteLine ("this is a computer of "+Type+" :");
Console .WriteLine (" "+info["cpu"]);
Console .WriteLine (" "+info["ram"]);
}
}
//Builder
public abstract class Builder
{
protected Computer computer;
public Computer Computpter
{
get
{
return computer;
using System.Collections;
//product
public class Computer
{
private string Type;
private Hashtable info=new Hashtable ();
public Computer(string type)
{
Type=type;
Console .WriteLine ("Conputer "+type+" is Builded!");
}
public string this[string key]
{
get
{
return (string)info[key];
}
set
{
info[key]=value;
}
}
public void Show()
{
Console .WriteLine ("this is a computer of "+Type+" :");
Console .WriteLine (" "+info["cpu"]);
Console .WriteLine (" "+info["ram"]);
}
}
//Builder
public abstract class Builder
{
protected Computer computer;
public Computer Computpter
{
get
{
return computer;
相关文章
- 王者荣耀S38赛季有什么更新 12-25
- 王者荣耀S38赛季有什么更新 王者荣耀S38赛季更新内容介绍 12-25
- 世界之外12.25有什么更新 世界之外12月25日更新内容介绍 12-25
- 光遇12.25红石碎片在哪里 光遇12月25日红石碎片位置攻略 12-25
- 奇迹暖暖绚光引途第二天怎么玩 绚光引途day2庆祝之舞搭配攻略 12-25
- 无限暖暖拍照打卡位置在哪里 无限暖暖世界巡游位置全攻略 12-25