forked from litiansum/DesignPattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProduct.cs
38 lines (36 loc) · 823 Bytes
/
Product.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Text;
namespace Builders
{
class Product
{
/// <summary>
/// 保存产品部件
/// </summary>
private IList<string> _parts;
public Product()
{
_parts = new List<string>();
}
/// <summary>
/// 添加产品部件
/// </summary>
/// <param name="part"></param>
public void Add(string part)
{
_parts.Add(part);
}
/// <summary>
/// 列举所有产品部件
/// </summary>
public void Show()
{
Console.WriteLine("\n产品 创建------");
foreach (var item in _parts)
{
Console.WriteLine(item);
}
}
}
}