├── .vs
└── UML
│ └── v14
│ └── .suo
├── AdapterModel
├── Adaptee.cs
├── Adapter.cs
├── Adapter.cs.js
├── AdapterModel.csproj
├── App.config
├── MangerAdaptee.cs
├── MangerAdapter.cs
├── MangerTarget.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Target.cs
├── bin
│ └── Debug
│ │ ├── AdapterModel.exe
│ │ ├── AdapterModel.exe.config
│ │ ├── AdapterModel.pdb
│ │ ├── AdapterModel.vshost.exe
│ │ ├── AdapterModel.vshost.exe.config
│ │ └── AdapterModel.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── AdapterModel.csproj.FileListAbsolute.txt
│ ├── AdapterModel.exe
│ ├── AdapterModel.pdb
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── AgencyModel
├── AgencyModel.csproj
├── App.config
├── Colleague.cs
├── ConcreColleagueOne.cs
├── ConcreteMesiator.cs
├── Mediator.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── bin
│ └── Debug
│ │ ├── AgencyModel.exe
│ │ ├── AgencyModel.exe.config
│ │ ├── AgencyModel.pdb
│ │ ├── AgencyModel.vshost.exe
│ │ ├── AgencyModel.vshost.exe.config
│ │ └── AgencyModel.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── AgencyModel.csproj.FileListAbsolute.txt
│ ├── AgencyModel.exe
│ ├── AgencyModel.pdb
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── AppearanceModel
├── App.config
├── AppearanceModel.csproj
├── Facade.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── SubSystemOne.cs
├── SubSystemTwo.cs
├── bin
│ └── Debug
│ │ ├── AppearanceModel.exe
│ │ ├── AppearanceModel.exe.config
│ │ ├── AppearanceModel.pdb
│ │ ├── AppearanceModel.vshost.exe
│ │ ├── AppearanceModel.vshost.exe.config
│ │ └── AppearanceModel.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── AppearanceModel.csproj.FileListAbsolute.txt
│ ├── AppearanceModel.exe
│ ├── AppearanceModel.pdb
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── BridgingModel
├── Android.cs
├── App.config
├── BridgingModel.csproj
├── Communication.cs
├── Demo
│ ├── CompaterCard.cs
│ ├── CompaterFunction.cs
│ ├── MacCompater.cs
│ └── WatchFunction.cs
├── PhoneCard.cs
├── PhoneFunction.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── VieoFunction.cs
├── bin
│ └── Debug
│ │ ├── BridgingModel.exe
│ │ ├── BridgingModel.exe.config
│ │ ├── BridgingModel.pdb
│ │ ├── BridgingModel.vshost.exe
│ │ ├── BridgingModel.vshost.exe.config
│ │ └── BridgingModel.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── BridgingModel.csproj.FileListAbsolute.txt
│ ├── BridgingModel.exe
│ ├── BridgingModel.pdb
│ ├── DesignTimeResolveAssemblyReferences.cache
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── BuilderModel
├── App.config
├── Builder.cs
├── BuilderModel.csproj
├── ConcreteBuilder1.cs
├── Director.cs
├── PersonBuilder.cs
├── PersonDirector.cs
├── PersonThinBuilder.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── bin
│ └── Debug
│ │ ├── BuilderModel.exe
│ │ ├── BuilderModel.exe.config
│ │ ├── BuilderModel.pdb
│ │ ├── BuilderModel.vshost.exe
│ │ ├── BuilderModel.vshost.exe.config
│ │ └── BuilderModel.vshost.exe.manifest
├── obj
│ └── Debug
│ │ ├── BuilderModel.csproj.FileListAbsolute.txt
│ │ ├── BuilderModel.exe
│ │ ├── BuilderModel.pdb
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
└── product.cs
├── DecorationModel
├── Accessories.cs
├── App.config
├── ApplePhone.cs
├── CompaterDemo
│ ├── Assessories.cs
│ ├── Compater.cs
│ ├── Decoration.cs
│ └── ProgrammeCompater.cs
├── DecorationModel.csproj
├── Decorator.cs
├── Phone.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── bin
│ └── Debug
│ │ ├── DecorationModel.exe
│ │ ├── DecorationModel.exe.config
│ │ ├── DecorationModel.pdb
│ │ ├── DecorationModel.vshost.exe
│ │ └── DecorationModel.vshost.exe.config
└── obj
│ └── Debug
│ ├── DecorationModel.csproj.FileListAbsolute.txt
│ ├── DecorationModel.exe
│ ├── DecorationModel.pdb
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── FactoryMethod
├── App.config
├── FactoryMethod.csproj
├── Interface.cs
├── Person.cs
├── PersonFactory.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Zhanteng.cs
├── bin
│ └── Debug
│ │ ├── FactoryMethod.exe
│ │ ├── FactoryMethod.exe.config
│ │ ├── FactoryMethod.pdb
│ │ ├── FactoryMethod.vshost.exe
│ │ ├── FactoryMethod.vshost.exe.config
│ │ └── FactoryMethod.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── FactoryMethod.csproj.FileListAbsolute.txt
│ ├── FactoryMethod.exe
│ ├── FactoryMethod.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── MemorandumModel
├── App.config
├── Caretaker.cs
├── Demo
│ ├── Manger.cs
│ ├── Memenber.cs
│ └── Work.cs
├── DemoTwo
│ ├── Person.cs
│ ├── 刻录数据.cs
│ └── 阎王爷.cs
├── Memento.cs
├── MemorandumModel.csproj
├── Originator.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── bin
│ └── Debug
│ │ ├── MemorandumModel.exe
│ │ ├── MemorandumModel.exe.config
│ │ ├── MemorandumModel.pdb
│ │ ├── MemorandumModel.vshost.exe
│ │ ├── MemorandumModel.vshost.exe.config
│ │ └── MemorandumModel.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── MemorandumModel.csproj.FileListAbsolute.txt
│ ├── MemorandumModel.exe
│ ├── MemorandumModel.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── Note
├── img
│ ├── 策略模式.png
│ ├── 简单工厂.png
│ └── 装饰着模式.png
├── 代理模式.txt
├── 原型模式.txt
├── 模板方法.txt
├── 状态模式.txt
├── 简单工厂模式与策略模式的比较.txt
├── 装饰模式.txt
└── 面向对象设计的几大原则.txt
├── PrototypeModel
├── App.config
├── ConcretePrototype.cs
├── Demo
│ └── CopyFather.cs
├── Person.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── ProtoType.cs
├── PrototypeModel.csproj
├── bin
│ └── Debug
│ │ ├── PrototypeModel.exe
│ │ ├── PrototypeModel.exe.config
│ │ ├── PrototypeModel.pdb
│ │ ├── PrototypeModel.vshost.exe
│ │ ├── PrototypeModel.vshost.exe.config
│ │ └── PrototypeModel.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── PrototypeModel.csproj.FileListAbsolute.txt
│ ├── PrototypeModel.csprojResolveAssemblyReference.cache
│ ├── PrototypeModel.exe
│ ├── PrototypeModel.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── ProxyModel
├── App.config
├── BetifalGair.cs
├── Interface.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Proxy.cs
├── ProxyModel.csproj
├── Pursuit.cs
├── bin
│ └── Debug
│ │ ├── ProxyModel.exe
│ │ ├── ProxyModel.exe.config
│ │ ├── ProxyModel.pdb
│ │ ├── ProxyModel.vshost.exe
│ │ ├── ProxyModel.vshost.exe.config
│ │ └── ProxyModel.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── ProxyModel.csproj.FileListAbsolute.txt
│ ├── ProxyModel.exe
│ ├── ProxyModel.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── SimpleFactory
├── App.config
├── Operation.cs
├── OperationAdd.cs
├── OperationFactory.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── SimpleFactory.csproj
├── bin
│ └── Debug
│ │ ├── SimpleFactory.exe
│ │ ├── SimpleFactory.exe.config
│ │ ├── SimpleFactory.pdb
│ │ ├── SimpleFactory.vshost.exe
│ │ ├── SimpleFactory.vshost.exe.config
│ │ └── SimpleFactory.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── SimpleFactory.csproj.FileListAbsolute.txt
│ ├── SimpleFactory.exe
│ ├── SimpleFactory.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── Singleton
├── App.config
├── Context.cs
├── MultiSingle.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── SingleTon.cs
├── Singleton.csproj
├── bin
│ └── Debug
│ │ ├── Singleton.exe
│ │ ├── Singleton.exe.config
│ │ ├── Singleton.pdb
│ │ ├── Singleton.vshost.exe
│ │ ├── Singleton.vshost.exe.config
│ │ └── Singleton.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── Singleton.csproj.FileListAbsolute.txt
│ ├── Singleton.exe
│ ├── Singleton.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── StatusModel
├── App.config
├── ConcreteState.cs
├── ConcreteStateB.cs
├── Context.cs
├── Demo
│ ├── DayContext.cs
│ ├── DayState.cs
│ └── Monthing.cs
├── FailState.cs
├── ForenoonState.cs
├── LightContext.cs
├── LightOff.cs
├── LightOn.cs
├── LightState.cs
├── LoginContext.cs
├── LoginState.cs
├── MorningState.cs
├── Program.cs
├── Project
│ ├── WorkContexted.cs
│ ├── WorkStates.cs
│ ├── WorkedState.cs
│ └── WorkingState.cs
├── Properties
│ └── AssemblyInfo.cs
├── State.cs
├── StatusModel.csproj
├── SuccessState.cs
├── WorkContext.cs
├── WorkState.cs
├── bin
│ └── Debug
│ │ ├── StatusModel.exe
│ │ ├── StatusModel.exe.config
│ │ ├── StatusModel.pdb
│ │ ├── StatusModel.vshost.exe
│ │ └── StatusModel.vshost.exe.config
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── StatusModel.csproj.FileListAbsolute.txt
│ ├── StatusModel.csprojResolveAssemblyReference.cache
│ ├── StatusModel.exe
│ ├── StatusModel.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── StrategyModel
├── App.config
├── ConcreteStrategyA.cs
├── ConcreteStrategyB.cs
├── Context.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Strategy.cs
├── StrategyModel.csproj
├── bin
│ └── Debug
│ │ ├── StrategyModel.exe
│ │ ├── StrategyModel.exe.config
│ │ ├── StrategyModel.pdb
│ │ ├── StrategyModel.vshost.exe
│ │ ├── StrategyModel.vshost.exe.config
│ │ └── StrategyModel.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── StrategyModel.csproj.FileListAbsolute.txt
│ ├── StrategyModel.exe
│ ├── StrategyModel.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── TemplateMethod
├── App.config
├── Person.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── QuestionFathor.cs
├── Student.cs
├── StudentOne.cs
├── TemplateMethod.csproj
├── bin
│ └── Debug
│ │ ├── TemplateMethod.exe
│ │ ├── TemplateMethod.exe.config
│ │ ├── TemplateMethod.pdb
│ │ ├── TemplateMethod.vshost.exe
│ │ ├── TemplateMethod.vshost.exe.config
│ │ └── TemplateMethod.vshost.exe.manifest
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── TemplateMethod.csproj.FileListAbsolute.txt
│ ├── TemplateMethod.exe
│ ├── TemplateMethod.pdb
│ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
└── UML.sln
/.vs/UML/v14/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/.vs/UML/v14/.suo
--------------------------------------------------------------------------------
/AdapterModel/Adaptee.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdapterModel
8 | {
9 | public class Adaptee
10 | {
11 | public void SpecificRequest()
12 | {
13 | Console.WriteLine("特殊要求!");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/AdapterModel/Adapter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdapterModel
8 | {
9 | public class Adapter:Target
10 | {
11 | private Adaptee adaptee;
12 | public override void Request()
13 | {
14 | adaptee.SpecificRequest();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/AdapterModel/Adapter.cs.js:
--------------------------------------------------------------------------------
1 | function inherits(subConstructor, superConstructor) {
2 | var proto = Object.create(
3 | superConstructor.prototype,
4 | {
5 | "constructor": {
6 | configurable: true,
7 | enumerable: false,
8 | writable: true,
9 | value: subConstructor
10 | }
11 | }
12 | );
13 | Object.defineProperty(subConstructor, "prototype", {
14 | configurable: true,
15 | enumerable: false,
16 | writable: true,
17 | value: proto
18 | });
19 | }
20 |
21 | var server = server || {};
22 | /// The Adapter class as defined in AdapterModel.Adapter
23 | server.Adapter = function() {
24 | };
25 |
26 | inherits(Adapter, Target);/// The Target class as defined in AdapterModel.Target
27 | server.Target = function() {
28 | };
29 |
30 |
--------------------------------------------------------------------------------
/AdapterModel/AdapterModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {57AB1C95-4797-4019-AFE3-58F7ECAD3DDF}
8 | Exe
9 | Properties
10 | AdapterModel
11 | AdapterModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | Adapter.cs
61 |
62 |
63 |
64 |
71 |
--------------------------------------------------------------------------------
/AdapterModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AdapterModel/MangerAdaptee.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdapterModel
8 | {
9 | public class MangerAdaptee
10 | {
11 | public void Show()
12 | {
13 | Console.WriteLine("特殊需求!");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/AdapterModel/MangerAdapter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdapterModel
8 | {
9 | public class MangerAdapte:MangerTarget
10 | {
11 | private MangerAdaptee adapter = new MangerAdaptee();
12 | public override void Handler()
13 | {
14 | adapter.Show();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/AdapterModel/MangerTarget.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdapterModel
8 | {
9 | public abstract class MangerTarget
10 | {
11 | public abstract void Handler();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/AdapterModel/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdapterModel
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //适配器模式
14 | Target traget = new Adapter();
15 | traget.Request();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/AdapterModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("AdapterModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AdapterModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("57ab1c95-4797-4019-afe3-58f7ecad3ddf")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/AdapterModel/Target.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdapterModel
8 | {
9 | public class Target
10 | {
11 | public virtual void Request()
12 | {
13 | Console.WriteLine("普通请求!");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/AdapterModel/bin/Debug/AdapterModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/bin/Debug/AdapterModel.exe
--------------------------------------------------------------------------------
/AdapterModel/bin/Debug/AdapterModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AdapterModel/bin/Debug/AdapterModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/bin/Debug/AdapterModel.pdb
--------------------------------------------------------------------------------
/AdapterModel/bin/Debug/AdapterModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/bin/Debug/AdapterModel.vshost.exe
--------------------------------------------------------------------------------
/AdapterModel/bin/Debug/AdapterModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AdapterModel/bin/Debug/AdapterModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AdapterModel/obj/Debug/AdapterModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AdapterModel\bin\Debug\AdapterModel.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AdapterModel\bin\Debug\AdapterModel.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AdapterModel\bin\Debug\AdapterModel.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AdapterModel\obj\Debug\AdapterModel.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AdapterModel\obj\Debug\AdapterModel.pdb
6 |
--------------------------------------------------------------------------------
/AdapterModel/obj/Debug/AdapterModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/obj/Debug/AdapterModel.exe
--------------------------------------------------------------------------------
/AdapterModel/obj/Debug/AdapterModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/obj/Debug/AdapterModel.pdb
--------------------------------------------------------------------------------
/AdapterModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/AdapterModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/AdapterModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/AdapterModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AdapterModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/AgencyModel/AgencyModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {70351B8E-7075-43A0-AA31-26F6D72EA9BC}
8 | Exe
9 | Properties
10 | AgencyModel
11 | AgencyModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
67 |
--------------------------------------------------------------------------------
/AgencyModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AgencyModel/Colleague.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AgencyModel
8 | {
9 | //抽象同事类
10 | public abstract class Colleague
11 | {
12 | protected Mediator mediator;
13 | public Colleague(Mediator mediator)
14 | {
15 | this.mediator = mediator;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/AgencyModel/ConcreColleagueOne.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AgencyModel
8 | {
9 | public class ConcreColleagueOne : Colleague
10 | {
11 | public ConcreColleagueOne(Mediator mediator) : base(mediator)
12 | {
13 | }
14 | public void Send(string message)
15 | {
16 | mediator.Send(message, this);
17 | }
18 | public void Notify(string message)
19 | {
20 | Console.WriteLine("同事1得到的信息{0}",message);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/AgencyModel/ConcreteMesiator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AgencyModel
8 | {
9 | public class ConcreteMesiator : Mediator
10 | {
11 | public ConcreColleagueOne ConcreColleagueOne { get; set; }
12 | public override void Send(string message, Colleague colleague)
13 | {
14 | if (colleague == ConcreColleagueOne)
15 | {
16 | ConcreColleagueOne.Notify(message);
17 | }
18 | else
19 | {
20 | Console.WriteLine("不存在!");
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/AgencyModel/Mediator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AgencyModel
8 | {
9 | public abstract class Mediator
10 | {
11 | public abstract void Send(string message,Colleague colleague);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/AgencyModel/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AgencyModel
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //中介者模式
14 | ConcreteMesiator m = new ConcreteMesiator();
15 | ConcreColleagueOne c = new ConcreColleagueOne(m);
16 | m.ConcreColleagueOne = c;
17 | c.Send("吃饭了吗?");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/AgencyModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("AgencyModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AgencyModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("70351b8e-7075-43a0-aa31-26f6d72ea9bc")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/AgencyModel/bin/Debug/AgencyModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/bin/Debug/AgencyModel.exe
--------------------------------------------------------------------------------
/AgencyModel/bin/Debug/AgencyModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AgencyModel/bin/Debug/AgencyModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/bin/Debug/AgencyModel.pdb
--------------------------------------------------------------------------------
/AgencyModel/bin/Debug/AgencyModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/bin/Debug/AgencyModel.vshost.exe
--------------------------------------------------------------------------------
/AgencyModel/bin/Debug/AgencyModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AgencyModel/bin/Debug/AgencyModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AgencyModel/obj/Debug/AgencyModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AgencyModel\bin\Debug\AgencyModel.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AgencyModel\bin\Debug\AgencyModel.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AgencyModel\bin\Debug\AgencyModel.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AgencyModel\obj\Debug\AgencyModel.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AgencyModel\obj\Debug\AgencyModel.pdb
6 |
--------------------------------------------------------------------------------
/AgencyModel/obj/Debug/AgencyModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/obj/Debug/AgencyModel.exe
--------------------------------------------------------------------------------
/AgencyModel/obj/Debug/AgencyModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/obj/Debug/AgencyModel.pdb
--------------------------------------------------------------------------------
/AgencyModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/AgencyModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/AgencyModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/AgencyModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AgencyModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/AppearanceModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AppearanceModel/AppearanceModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D196CB7B-F70C-4A06-A4E1-E60EB76153ED}
8 | Exe
9 | Properties
10 | AppearanceModel
11 | AppearanceModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
63 |
--------------------------------------------------------------------------------
/AppearanceModel/Facade.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AppearanceModel
8 | {
9 | public class Facade
10 | {
11 | SubSystemOne one;
12 | SubSystemTwo two;
13 | public Facade()
14 | {
15 | one = new SubSystemOne();
16 | two = new SubSystemTwo();
17 | }
18 | public void MethodA()
19 | {
20 | Console.WriteLine("方法组A()---");
21 | one.MethodOne();
22 | }
23 | public void MethodB()
24 | {
25 | Console.WriteLine("方法组B()---");
26 | one.MethodOne();
27 | two.MethodTwo();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/AppearanceModel/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AppearanceModel
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //外观模式:遵循了依赖倒置原则
14 | //为子系统中的一组接口提供一个一致的界面,此模式定义了一个高层接口,这个接口
15 | //使得这一子系统更加容易使用。
16 | Facade face = new Facade();
17 | face.MethodA();
18 | face.MethodB();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/AppearanceModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("AppearanceModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AppearanceModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("d196cb7b-f70c-4a06-a4e1-e60eb76153ed")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/AppearanceModel/SubSystemOne.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AppearanceModel
8 | {
9 | public class SubSystemOne
10 | {
11 | public void MethodOne()
12 | {
13 | Console.WriteLine("子系统方法一");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/AppearanceModel/SubSystemTwo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AppearanceModel
8 | {
9 | public class SubSystemTwo
10 | {
11 | public void MethodTwo()
12 | {
13 | Console.WriteLine("实现方法二");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/AppearanceModel/bin/Debug/AppearanceModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/bin/Debug/AppearanceModel.exe
--------------------------------------------------------------------------------
/AppearanceModel/bin/Debug/AppearanceModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AppearanceModel/bin/Debug/AppearanceModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/bin/Debug/AppearanceModel.pdb
--------------------------------------------------------------------------------
/AppearanceModel/bin/Debug/AppearanceModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/bin/Debug/AppearanceModel.vshost.exe
--------------------------------------------------------------------------------
/AppearanceModel/bin/Debug/AppearanceModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AppearanceModel/bin/Debug/AppearanceModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AppearanceModel/obj/Debug/AppearanceModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AppearanceModel\bin\Debug\AppearanceModel.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AppearanceModel\bin\Debug\AppearanceModel.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AppearanceModel\bin\Debug\AppearanceModel.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AppearanceModel\obj\Debug\AppearanceModel.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\AppearanceModel\obj\Debug\AppearanceModel.pdb
6 |
--------------------------------------------------------------------------------
/AppearanceModel/obj/Debug/AppearanceModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/obj/Debug/AppearanceModel.exe
--------------------------------------------------------------------------------
/AppearanceModel/obj/Debug/AppearanceModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/obj/Debug/AppearanceModel.pdb
--------------------------------------------------------------------------------
/AppearanceModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/AppearanceModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/AppearanceModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/AppearanceModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/AppearanceModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/BridgingModel/Android.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel
8 | {
9 | public class Android : PhoneCard
10 | {
11 | public Android(PhoneFunction PhoneFunction) : base(PhoneFunction)
12 | {
13 | }
14 |
15 | public override void Run()
16 | {
17 | base.PhoneFunction.Run();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/BridgingModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BridgingModel/BridgingModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {724F2E1C-E6A4-4EAF-982C-F32D3B423305}
8 | Exe
9 | Properties
10 | BridgingModel
11 | BridgingModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
69 |
--------------------------------------------------------------------------------
/BridgingModel/Communication.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel
8 | {
9 | public class Communication : PhoneFunction
10 | {
11 | public override void Run()
12 | {
13 | Console.WriteLine("通讯功能!");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/BridgingModel/Demo/CompaterCard.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel.Demo
8 | {
9 | public abstract class CompaterCard
10 | {
11 | public CompaterFunction function { get; set; }
12 | public CompaterCard(CompaterFunction function)
13 | {
14 | this.function = function;
15 | }
16 | public abstract void Run();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/BridgingModel/Demo/CompaterFunction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel.Demo
8 | {
9 | public abstract class CompaterFunction
10 | {
11 | public abstract void Function();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/BridgingModel/Demo/MacCompater.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel.Demo
8 | {
9 | public class MacCompater : CompaterCard
10 | {
11 | public MacCompater(CompaterFunction function) : base(function)
12 | {
13 | }
14 |
15 | public override void Run()
16 | {
17 | base.function.Function();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/BridgingModel/Demo/WatchFunction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel.Demo
8 | {
9 | public class WatchFunction : CompaterFunction
10 | {
11 | public override void Function()
12 | {
13 | Console.WriteLine("看电视的功能");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/BridgingModel/PhoneCard.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel
8 | {
9 | public abstract class PhoneCard
10 | {
11 | public PhoneFunction PhoneFunction { get; set; }
12 | public PhoneCard(PhoneFunction PhoneFunction)
13 | {
14 | this.PhoneFunction = PhoneFunction;
15 | }
16 | public abstract void Run();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/BridgingModel/PhoneFunction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel
8 | {
9 | public abstract class PhoneFunction
10 | {
11 | public abstract void Run();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/BridgingModel/Program.cs:
--------------------------------------------------------------------------------
1 | using BridgingModel.Demo;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace BridgingModel
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | //桥连模式
15 | Android android = new Android(new VieoFunction());
16 | android.Run();
17 |
18 | MacCompater Mac = new MacCompater(new WatchFunction());
19 | Mac.Run();
20 |
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/BridgingModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("BridgingModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BridgingModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("724f2e1c-e6a4-4eaf-982c-f32d3b423305")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/BridgingModel/VieoFunction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgingModel
8 | {
9 | public class VieoFunction : PhoneFunction
10 | {
11 | public override void Run()
12 | {
13 | Console.WriteLine("视频功能!");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/BridgingModel/bin/Debug/BridgingModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/bin/Debug/BridgingModel.exe
--------------------------------------------------------------------------------
/BridgingModel/bin/Debug/BridgingModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BridgingModel/bin/Debug/BridgingModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/bin/Debug/BridgingModel.pdb
--------------------------------------------------------------------------------
/BridgingModel/bin/Debug/BridgingModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/bin/Debug/BridgingModel.vshost.exe
--------------------------------------------------------------------------------
/BridgingModel/bin/Debug/BridgingModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BridgingModel/bin/Debug/BridgingModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/BridgingModel/obj/Debug/BridgingModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BridgingModel\bin\Debug\BridgingModel.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BridgingModel\bin\Debug\BridgingModel.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BridgingModel\bin\Debug\BridgingModel.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BridgingModel\obj\Debug\BridgingModel.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BridgingModel\obj\Debug\BridgingModel.pdb
6 |
--------------------------------------------------------------------------------
/BridgingModel/obj/Debug/BridgingModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/obj/Debug/BridgingModel.exe
--------------------------------------------------------------------------------
/BridgingModel/obj/Debug/BridgingModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/obj/Debug/BridgingModel.pdb
--------------------------------------------------------------------------------
/BridgingModel/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/BridgingModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/BridgingModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/BridgingModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/BridgingModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BridgingModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/BuilderModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BuilderModel/Builder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BuilderModel
8 | {
9 | public abstract class Builder
10 | {
11 | public abstract void BuilderPartA();
12 | public abstract void BuilderPartB();
13 | public abstract product GetResult();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/BuilderModel/BuilderModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {9064AD86-5A47-4952-8C67-D80B0DC7A5BE}
8 | Exe
9 | Properties
10 | BuilderModel
11 | BuilderModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
68 |
--------------------------------------------------------------------------------
/BuilderModel/ConcreteBuilder1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BuilderModel
8 | {
9 | public class ConcreteBuilder1 : Builder
10 | {
11 | private product pro=new product();
12 | public override void BuilderPartA()
13 | {
14 | pro.Add("产品部件A");
15 | }
16 |
17 | public override void BuilderPartB()
18 | {
19 | pro.Add("产品部件B");
20 | }
21 |
22 | public override product GetResult()
23 | {
24 | return pro;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/BuilderModel/Director.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BuilderModel
8 | {
9 | public class Director
10 | {
11 | public void Construct(Builder builder)
12 | {
13 | builder.BuilderPartA();
14 | builder.BuilderPartB();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/BuilderModel/PersonBuilder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 |
8 | namespace BuilderModel
9 | {
10 | public abstract class PersonBuilder
11 | {
12 | protected string g;
13 | protected int p;
14 | public PersonBuilder(string g,int p)
15 | {
16 | this.p = p;
17 | this.g = g;
18 | }
19 | public abstract void BuildHead();
20 | public abstract void BuildBody();
21 | public abstract void BuildArmLeft();
22 | public abstract void BuildArmRight();
23 | public abstract void BuildLegLeft();
24 | public abstract void BulldLegRight();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/BuilderModel/PersonDirector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BuilderModel
8 | {
9 | //起到了指挥的作用,这样用户就不用知道具体的实现流程
10 | public class PersonDirector
11 | {
12 | PersonBuilder per;
13 | public PersonDirector(PersonBuilder per)
14 | {
15 | //传如需要建造的对象
16 | this.per = per;
17 | }
18 | public void Complete()
19 | {
20 | per.BuildHead();
21 | per.BuildBody();
22 | per.BuildArmLeft();
23 | per.BuildArmRight();
24 | per.BuildLegLeft();
25 | per.BulldLegRight();
26 | Console.WriteLine("产品完成生产!");
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/BuilderModel/PersonThinBuilder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace BuilderModel
9 | {
10 | public class PersonThinBuilder : PersonBuilder
11 | {
12 | public PersonThinBuilder(string g, int p) : base(g, p)
13 | {
14 | }
15 |
16 | public override void BuildArmLeft()
17 | {
18 | Console.WriteLine("建造步骤1");
19 | }
20 |
21 | public override void BuildArmRight()
22 | {
23 | Console.WriteLine("建造步骤2");
24 | }
25 |
26 | public override void BuildBody()
27 | {
28 | Console.WriteLine("建造步骤3");
29 | }
30 |
31 | public override void BuildHead()
32 | {
33 | Console.WriteLine("建造步骤4");
34 | }
35 |
36 | public override void BuildLegLeft()
37 | {
38 | Console.WriteLine("建造步骤5");
39 | }
40 |
41 | public override void BulldLegRight()
42 | {
43 | Console.WriteLine("建造步骤6");
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/BuilderModel/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BuilderModel
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //建造者模式
14 | //PersonThinBuilder thin = new PersonThinBuilder("张腾", 1);
15 | //PersonDirector director = new PersonDirector(thin);
16 | //director.Complete();
17 | //在我的理解是在建造一个东西的时候,他具体的流程不会发生改变,但是流程内部会发生改变。
18 | //就比方说人会经历的婴儿 幼年 青年 中年 老年,在每个人活到70岁的时候都会经历这几个阶段
19 | //而这几个阶段每个人的生活又是各种各样的,也就是他所经历的不同,则在他这几个阶段的方法实现也是不同的。
20 | //而建造的流程过程用户是不需要知道,他只需要拿到结果.
21 |
22 | //指挥者:通过指挥者来隔离生产流程出产品的具体流程
23 | Director director = new Director();
24 | //具体的产品
25 | Builder BuilderA = new ConcreteBuilder1();
26 | //通过指挥者来实现产品生产的流程
27 | director.Construct(BuilderA);
28 | //给结果流程就可以不用在指挥者中实现。建造者只需要得到结果就可以
29 | product pro=BuilderA.GetResult();
30 | pro.Show();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/BuilderModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("BuilderModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BuilderModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("9064ad86-5a47-4952-8c67-d80b0dc7a5be")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/BuilderModel/bin/Debug/BuilderModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/bin/Debug/BuilderModel.exe
--------------------------------------------------------------------------------
/BuilderModel/bin/Debug/BuilderModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BuilderModel/bin/Debug/BuilderModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/bin/Debug/BuilderModel.pdb
--------------------------------------------------------------------------------
/BuilderModel/bin/Debug/BuilderModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/bin/Debug/BuilderModel.vshost.exe
--------------------------------------------------------------------------------
/BuilderModel/bin/Debug/BuilderModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BuilderModel/bin/Debug/BuilderModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/BuilderModel/obj/Debug/BuilderModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BuilderModel\bin\Debug\BuilderModel.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BuilderModel\bin\Debug\BuilderModel.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BuilderModel\bin\Debug\BuilderModel.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BuilderModel\obj\Debug\BuilderModel.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\BuilderModel\obj\Debug\BuilderModel.pdb
6 |
--------------------------------------------------------------------------------
/BuilderModel/obj/Debug/BuilderModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/obj/Debug/BuilderModel.exe
--------------------------------------------------------------------------------
/BuilderModel/obj/Debug/BuilderModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/obj/Debug/BuilderModel.pdb
--------------------------------------------------------------------------------
/BuilderModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/BuilderModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/BuilderModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/BuilderModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/BuilderModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/BuilderModel/product.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BuilderModel
8 | {
9 | public class product
10 | {
11 | IList parts = new List();
12 | public void Add(string part)
13 | {
14 | parts.Add(part);
15 | }
16 | public void Show()
17 | {
18 | Console.WriteLine("\n产品创建----");
19 | foreach (string item in parts)
20 | {
21 | Console.WriteLine(item);
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/DecorationModel/Accessories.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel
8 | {
9 | public class Accessories:Decorator
10 | {
11 | public override void Print()
12 | {
13 | //在新产品生成的时候需要保留住原始的功能同时也可以添加自己的功能
14 | //重这里我们发现了他准寻了开放-封闭原则,多扩展,少修改的原则。
15 | base.Print();
16 | //同时带上自己的功能
17 | Console.WriteLine("原始功能添加完毕!");
18 | Method();
19 | Console.WriteLine("功能装饰完毕!");
20 | }
21 | public void Method()
22 | {
23 | Console.WriteLine("正在追加我的的特有的功能!");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/DecorationModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/DecorationModel/ApplePhone.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel
8 | {
9 | public class ApplePhone : Phone
10 | {
11 | public override void Print()
12 | {
13 | Console.WriteLine("这里是原始模板手机功能!");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/DecorationModel/CompaterDemo/Assessories.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel.CompaterDemo
8 | {
9 | public class Assessories : Decoration
10 | {
11 | public Assessories(Compater compater) : base(compater)
12 | {
13 | }
14 | public override void Print()
15 | {
16 | //指挥者调用上一次的功能
17 | base.Print();
18 | MyMethod();
19 | }
20 | public void MyMethod()
21 | {
22 | Console.WriteLine("添加的新功能!");
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/DecorationModel/CompaterDemo/Compater.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel.CompaterDemo
8 | {
9 | public abstract class Compater
10 | {
11 | public abstract void Print();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/DecorationModel/CompaterDemo/Decoration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel.CompaterDemo
8 | {
9 | public abstract class Decoration:Compater
10 | {
11 | protected Compater compater { get; set; }
12 | public Decoration(Compater compater)
13 | {
14 | this.compater = compater;
15 | }
16 |
17 | public override void Print()
18 | {
19 | if (compater != null)
20 | {
21 | compater.Print();
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/DecorationModel/CompaterDemo/ProgrammeCompater.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel.CompaterDemo
8 | {
9 | //在最开始生产的时候生产出最原始的功能
10 | public class ProgrammeCompater : Compater
11 | {
12 | public override void Print()
13 | {
14 | Console.WriteLine("编程功能!");
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DecorationModel/DecorationModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {343B7276-97C8-469B-A781-578263CACC76}
8 | Exe
9 | Properties
10 | DecorationModel
11 | DecorationModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
68 |
--------------------------------------------------------------------------------
/DecorationModel/Decorator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel
8 | {
9 | public abstract class Decorator:Phone
10 | {
11 | protected Phone phone;
12 | //传入的是被装饰着对象
13 | public void DecoratorObj(Phone phone)
14 | {
15 | this.phone = phone;
16 | }
17 | public override void Print()
18 | {
19 | if (phone!=null)
20 | {
21 | //在其使用的时候必须执行原来的模板代码
22 | phone.Print();
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/DecorationModel/Phone.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel
8 | {
9 | public abstract class Phone
10 | {
11 | public abstract void Print();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/DecorationModel/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DecorationModel
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | ApplePhone Template = new ApplePhone();
14 | Accessories a=new Accessories();
15 | a.DecoratorObj(Template);
16 | a.Print();
17 | Console.ReadKey();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/DecorationModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("DecorationModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DecorationModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("343b7276-97c8-469b-a781-578263cacc76")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DecorationModel/bin/Debug/DecorationModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/bin/Debug/DecorationModel.exe
--------------------------------------------------------------------------------
/DecorationModel/bin/Debug/DecorationModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/DecorationModel/bin/Debug/DecorationModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/bin/Debug/DecorationModel.pdb
--------------------------------------------------------------------------------
/DecorationModel/bin/Debug/DecorationModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/bin/Debug/DecorationModel.vshost.exe
--------------------------------------------------------------------------------
/DecorationModel/bin/Debug/DecorationModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/DecorationModel/obj/Debug/DecorationModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\DecorationModel\bin\Debug\DecorationModel.exe.config
2 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\DecorationModel\bin\Debug\DecorationModel.exe
3 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\DecorationModel\bin\Debug\DecorationModel.pdb
4 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\DecorationModel\obj\Debug\DecorationModel.exe
5 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\DecorationModel\obj\Debug\DecorationModel.pdb
6 |
--------------------------------------------------------------------------------
/DecorationModel/obj/Debug/DecorationModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/obj/Debug/DecorationModel.exe
--------------------------------------------------------------------------------
/DecorationModel/obj/Debug/DecorationModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/obj/Debug/DecorationModel.pdb
--------------------------------------------------------------------------------
/DecorationModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/DecorationModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/DecorationModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/DecorationModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/DecorationModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/FactoryMethod/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FactoryMethod/FactoryMethod.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {2DECD416-8E84-405E-BCED-1F507BF84784}
8 | Exe
9 | Properties
10 | FactoryMethod
11 | FactoryMethod
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/FactoryMethod/Interface.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FactoryMethod
8 | {
9 | interface Interface
10 | {
11 | Person GetPerson();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/FactoryMethod/Person.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FactoryMethod
8 | {
9 | public class Person
10 | {
11 | public void Eat()
12 | {
13 | Console.WriteLine("吃!");
14 | }
15 | public void Drink()
16 | {
17 | Console.WriteLine("喝!");
18 | }
19 | public void Sellp()
20 | {
21 | Console.WriteLine("谁!");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/FactoryMethod/PersonFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FactoryMethod
8 | {
9 | public class PersonFactory : Interface
10 | {
11 | public Person GetPerson()
12 | {
13 | return new Zhanteng();
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/FactoryMethod/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FactoryMethod
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | Interface factory = new PersonFactory();
14 | Person per = factory.GetPerson();
15 | per.Eat();
16 | per.Drink();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/FactoryMethod/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("FactoryMethod")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("FactoryMethod")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("2decd416-8e84-405e-bced-1f507bf84784")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/FactoryMethod/Zhanteng.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FactoryMethod
8 | {
9 | public class Zhanteng:Person
10 | {
11 |
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/FactoryMethod/bin/Debug/FactoryMethod.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/bin/Debug/FactoryMethod.exe
--------------------------------------------------------------------------------
/FactoryMethod/bin/Debug/FactoryMethod.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FactoryMethod/bin/Debug/FactoryMethod.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/bin/Debug/FactoryMethod.pdb
--------------------------------------------------------------------------------
/FactoryMethod/bin/Debug/FactoryMethod.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/bin/Debug/FactoryMethod.vshost.exe
--------------------------------------------------------------------------------
/FactoryMethod/bin/Debug/FactoryMethod.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FactoryMethod/bin/Debug/FactoryMethod.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/FactoryMethod/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/FactoryMethod/obj/Debug/FactoryMethod.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\FactoryMethod\bin\Debug\FactoryMethod.exe.config
2 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\FactoryMethod\bin\Debug\FactoryMethod.exe
3 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\FactoryMethod\bin\Debug\FactoryMethod.pdb
4 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\FactoryMethod\obj\Debug\FactoryMethod.exe
5 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\FactoryMethod\obj\Debug\FactoryMethod.pdb
6 |
--------------------------------------------------------------------------------
/FactoryMethod/obj/Debug/FactoryMethod.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/obj/Debug/FactoryMethod.exe
--------------------------------------------------------------------------------
/FactoryMethod/obj/Debug/FactoryMethod.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/obj/Debug/FactoryMethod.pdb
--------------------------------------------------------------------------------
/FactoryMethod/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/FactoryMethod/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/FactoryMethod/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/FactoryMethod/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/MemorandumModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MemorandumModel/Caretaker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel
8 | {
9 | //管理者
10 | public class Caretaker
11 | {
12 | public Memento Memento { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MemorandumModel/Demo/Manger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel.Demo
8 | {
9 | public class Manger
10 | {
11 | public Memenber menmber { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MemorandumModel/Demo/Memenber.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel.Demo
8 | {
9 | public class Memenber
10 | {
11 | public string State { get; set; }
12 | public Memenber(string State)
13 | {
14 | this.State = State;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MemorandumModel/Demo/Work.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel.Demo
8 | {
9 | public class Work
10 | {
11 | public string State { get; set; }
12 | public Memenber SetNew()
13 | {
14 | return new Memenber(State);
15 | }
16 | public void Show()
17 | {
18 | Console.WriteLine($"当前状态{State}");
19 | }
20 | public void SetOld(Memenber memenber)
21 | {
22 | this.State = memenber.State;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MemorandumModel/DemoTwo/Person.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel.DemoTwo
8 | {
9 | public class Person
10 | {
11 | public string 后悔药 { get; set; }
12 | public void Show()
13 | {
14 | Console.WriteLine($"您当前正在步入{后悔药}");
15 | }
16 | public 刻录数据 刻录时光机器()
17 | {
18 | return new 刻录数据(后悔药);
19 | }
20 | public void 回到从前(刻录数据 回到从前的药)
21 | {
22 | this.后悔药 = 回到从前的药.后悔药;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MemorandumModel/DemoTwo/刻录数据.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel.DemoTwo
8 | {
9 | public class 刻录数据
10 | {
11 | public string 后悔药 { get; set; }
12 | public 刻录数据(string 后悔药)
13 | {
14 | this.后悔药 = 后悔药;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MemorandumModel/DemoTwo/阎王爷.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel.DemoTwo
8 | {
9 | public class 阎王爷
10 | {
11 | public 刻录数据 数据 { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MemorandumModel/Memento.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel
8 | {
9 | public class Memento
10 | {
11 | public string State { get; set; }
12 | public Memento(string state)
13 | {
14 | this.State = state;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MemorandumModel/Originator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MemorandumModel
8 | {
9 | //发起人
10 | public class Originator
11 | {
12 | public string State { get; set; }
13 | public Memento CreateMemento()
14 | {
15 | return (new Memento(State));
16 | }
17 | public void SetMemento(Memento memento)
18 | {
19 | State = memento.State;
20 | }
21 | public void Show()
22 | {
23 | Console.WriteLine($"当前状态{State}");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MemorandumModel/Program.cs:
--------------------------------------------------------------------------------
1 | using MemorandumModel.Demo;
2 | using MemorandumModel.DemoTwo;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace MemorandumModel
10 | {
11 | class Program
12 | {
13 | static void Main(string[] args)
14 | {
15 | //备忘录模式
16 | //Originator o = new Originator();
17 | //o.State = "On";
18 | //o.Show();
19 | ////创建备忘录保存之前的数据
20 | //Caretaker c = new Caretaker();
21 | ////修改之前的数据
22 | //c.Memento = o.CreateMemento();
23 | //o.State = "OFF";
24 | //o.Show();
25 | ////恢复之前的数据
26 | //o.SetMemento(c.Memento);
27 | //o.Show();
28 |
29 | //Work w = new Work();
30 | //w.State = "上班!";
31 | //w.Show();
32 | //Manger m = new Manger();
33 | //m.menmber = w.SetNew();
34 | //w.State = "下班";
35 | //w.Show();
36 | //w.SetOld(m.menmber);
37 | //w.Show();
38 |
39 | Person per = new Person();
40 | per.后悔药 = "幼年";
41 | per.Show();
42 | 阎王爷 爷 = new 阎王爷();
43 | 爷.数据 = per.刻录时光机器();
44 | per.后悔药 = "老年";
45 | per.Show();
46 | Console.WriteLine("您正在进入老年!是不是觉得还有好多事没做,我现在让你回到幼年!");
47 | per.回到从前(爷.数据);
48 | per.Show();
49 |
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/MemorandumModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("MemorandumModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MemorandumModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("ae236871-3b31-403e-9788-3643cf0c4e75")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/MemorandumModel/bin/Debug/MemorandumModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/bin/Debug/MemorandumModel.exe
--------------------------------------------------------------------------------
/MemorandumModel/bin/Debug/MemorandumModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MemorandumModel/bin/Debug/MemorandumModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/bin/Debug/MemorandumModel.pdb
--------------------------------------------------------------------------------
/MemorandumModel/bin/Debug/MemorandumModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/bin/Debug/MemorandumModel.vshost.exe
--------------------------------------------------------------------------------
/MemorandumModel/bin/Debug/MemorandumModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MemorandumModel/bin/Debug/MemorandumModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MemorandumModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/MemorandumModel/obj/Debug/MemorandumModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\MemorandumModel\bin\Debug\MemorandumModel.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\MemorandumModel\bin\Debug\MemorandumModel.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\MemorandumModel\bin\Debug\MemorandumModel.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\MemorandumModel\obj\Debug\MemorandumModel.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\MemorandumModel\obj\Debug\MemorandumModel.pdb
6 |
--------------------------------------------------------------------------------
/MemorandumModel/obj/Debug/MemorandumModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/obj/Debug/MemorandumModel.exe
--------------------------------------------------------------------------------
/MemorandumModel/obj/Debug/MemorandumModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/obj/Debug/MemorandumModel.pdb
--------------------------------------------------------------------------------
/MemorandumModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/MemorandumModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/MemorandumModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/MemorandumModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/Note/img/策略模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/img/策略模式.png
--------------------------------------------------------------------------------
/Note/img/简单工厂.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/img/简单工厂.png
--------------------------------------------------------------------------------
/Note/img/装饰着模式.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/img/装饰着模式.png
--------------------------------------------------------------------------------
/Note/代理模式.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/代理模式.txt
--------------------------------------------------------------------------------
/Note/原型模式.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/原型模式.txt
--------------------------------------------------------------------------------
/Note/模板方法.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/模板方法.txt
--------------------------------------------------------------------------------
/Note/状态模式.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/状态模式.txt
--------------------------------------------------------------------------------
/Note/简单工厂模式与策略模式的比较.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/简单工厂模式与策略模式的比较.txt
--------------------------------------------------------------------------------
/Note/装饰模式.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/装饰模式.txt
--------------------------------------------------------------------------------
/Note/面向对象设计的几大原则.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Note/面向对象设计的几大原则.txt
--------------------------------------------------------------------------------
/PrototypeModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/PrototypeModel/ConcretePrototype.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PrototypeModel
8 | {
9 | public class ConcretePrototype : ProtoType
10 | {
11 | public ConcretePrototype(string id) : base(id)
12 | {
13 |
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/PrototypeModel/Demo/CopyFather.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PrototypeModel.Demo
8 | {
9 | public class CopyFather:ICloneable
10 | {
11 | public int Age { get; set; }
12 | public string Name { get; set; }
13 | public CopyFather(string name,int age)
14 | {
15 | this.Name = name;
16 | this.Age = age;
17 | }
18 | public object Clone()
19 | {
20 | return this.MemberwiseClone();
21 | }
22 | public void Show()
23 | {
24 | Console.WriteLine($"我叫{Name}今年{Age}岁了!");
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/PrototypeModel/Person.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PrototypeModel
8 | {
9 | public class Person : ICloneable
10 | {
11 | public int Age { get; set; }
12 | public string Name { get; set; }
13 | public Person(string name,int age)
14 | {
15 | this.Name = name;
16 | this.Age = age;
17 | }
18 | public object Clone()
19 | {
20 | return this.MemberwiseClone();
21 | }
22 | public void show()
23 | {
24 | Console.WriteLine($"我的名字叫:{Name},今年{Age}岁!");
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/PrototypeModel/Program.cs:
--------------------------------------------------------------------------------
1 | using PrototypeModel.Demo;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Data.SqlClient;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace PrototypeModel
10 | {
11 | class Program
12 | {
13 | static void Main(string[] args)
14 | {
15 | //原型模式(浅复制)
16 | //ConcretePrototype p1 = new ConcretePrototype("001");
17 | //ConcretePrototype p2 = (ConcretePrototype)p1.Clone();
18 | //Console.WriteLine(p2.Id);
19 |
20 | //原型模式(深复制)
21 | //ProtoType proOne = new ProtoType("2003");
22 | //ProtoType proTwo= proOne.Clone() as ProtoType;
23 | //proOne.Person.show();
24 | //proTwo.Person.show();
25 | //Console.WriteLine(proOne.Id);
26 | //Console.WriteLine(proTwo.Id);
27 |
28 | //原型模式:主要针对于复制对象,减少每一次都实例化,同时也增强了性能,复制的关键需要继承Icloneable
29 | //同时实现接口的克隆方法,再在里面实现this.MemberwiseClone()方法。
30 |
31 | //我们查看MSDN会发现,MenberwiseClone()方法是浅复制:也就是说他只能复制该方法中值类型数据,而引用类型不会被复制下来
32 | //那我们如何来实现深复制呢?我们需要在复制的该类型里面的引用类型加入被克隆标签。在该类型复制的时候我们将他给复制完成。
33 | //这样我们就完成了深复制。
34 | CopyFather copyOne = new CopyFather("张腾",19);
35 | copyOne.Show();
36 | CopyFather copyTwo = new CopyFather("张三", 20);
37 | copyTwo.Show();
38 | CopyFather copyContext= copyOne.Clone() as CopyFather;
39 | copyContext.Show();
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/PrototypeModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("PrototypeModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PrototypeModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("3777a5b1-cdbf-4acf-be35-b5c9935d735b")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/PrototypeModel/ProtoType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PrototypeModel
8 | {
9 | public class ProtoType:ICloneable
10 | {
11 | public string Id { get; set; }
12 | //深复制
13 | public Person Person { get; set; }
14 | public ProtoType(string id)
15 | {
16 | Person = new Person("张腾",23);
17 | this.Id = id;
18 | }
19 | private ProtoType(Person person)
20 | {
21 | this.Person = person.Clone() as Person;
22 | }
23 | public object Clone()
24 | {
25 | //克隆之前让之前的克隆完成,然后在给这个对象相关对象复制,
26 | //最终返回一个深复制的简历对象。
27 | ProtoType pro = new ProtoType(this.Person);
28 | pro.Id = "001";
29 | return pro;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/PrototypeModel/PrototypeModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3777A5B1-CDBF-4ACF-BE35-B5C9935D735B}
8 | Exe
9 | Properties
10 | PrototypeModel
11 | PrototypeModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/PrototypeModel/bin/Debug/PrototypeModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/bin/Debug/PrototypeModel.exe
--------------------------------------------------------------------------------
/PrototypeModel/bin/Debug/PrototypeModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/PrototypeModel/bin/Debug/PrototypeModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/bin/Debug/PrototypeModel.pdb
--------------------------------------------------------------------------------
/PrototypeModel/bin/Debug/PrototypeModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/bin/Debug/PrototypeModel.vshost.exe
--------------------------------------------------------------------------------
/PrototypeModel/bin/Debug/PrototypeModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/PrototypeModel/bin/Debug/PrototypeModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/PrototypeModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/PrototypeModel/obj/Debug/PrototypeModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\PrototypeModel\bin\Debug\PrototypeModel.exe.config
2 | C:\Users\Administrator\documents\visual studio 2015\Projects\UML\PrototypeModel\bin\Debug\PrototypeModel.exe
3 | C:\Users\Administrator\documents\visual studio 2015\Projects\UML\PrototypeModel\bin\Debug\PrototypeModel.pdb
4 | C:\Users\Administrator\documents\visual studio 2015\Projects\UML\PrototypeModel\obj\Debug\PrototypeModel.exe
5 | C:\Users\Administrator\documents\visual studio 2015\Projects\UML\PrototypeModel\obj\Debug\PrototypeModel.pdb
6 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\PrototypeModel\obj\Debug\PrototypeModel.csprojResolveAssemblyReference.cache
7 |
--------------------------------------------------------------------------------
/PrototypeModel/obj/Debug/PrototypeModel.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/obj/Debug/PrototypeModel.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/PrototypeModel/obj/Debug/PrototypeModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/obj/Debug/PrototypeModel.exe
--------------------------------------------------------------------------------
/PrototypeModel/obj/Debug/PrototypeModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/obj/Debug/PrototypeModel.pdb
--------------------------------------------------------------------------------
/PrototypeModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/PrototypeModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/PrototypeModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/PrototypeModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/ProxyModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProxyModel/BetifalGair.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProxyModel
8 | {
9 | public class BetifalGair
10 | {
11 | public string Name { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ProxyModel/Interface.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProxyModel
8 | {
9 | interface Interface
10 | {
11 | void Flower();
12 | void Chocolates();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ProxyModel/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProxyModel
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | BetifalGair gair = new BetifalGair();
14 | gair.Name = "娇娇";
15 | Proxy proxy = new Proxy(gair);
16 | proxy.Flower();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ProxyModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ProxyModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ProxyModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("c15d6039-d2d6-41d5-be06-5a786a326e69")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ProxyModel/Proxy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProxyModel
8 | {
9 | public class Proxy : Interface
10 | {
11 | public Pursuit pursuit { get; set; }
12 | public Proxy(BetifalGair betifalGair)
13 | {
14 | pursuit = new Pursuit(betifalGair);
15 | }
16 | public void Chocolates()
17 | {
18 | pursuit.Chocolates();
19 | }
20 |
21 | public void Flower()
22 | {
23 | pursuit.Flower();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ProxyModel/ProxyModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C15D6039-D2D6-41D5-BE06-5A786A326E69}
8 | Exe
9 | Properties
10 | ProxyModel
11 | ProxyModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/ProxyModel/Pursuit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProxyModel
8 | {
9 | //此为真实的追求者,与代理着必须都继承接口
10 | public class Pursuit : Interface
11 | {
12 | public BetifalGair BetifalGair { get; set; }
13 | public Pursuit(BetifalGair BetifalGair)
14 | {
15 | this.BetifalGair = BetifalGair;
16 | }
17 | public void Chocolates()
18 | {
19 | Console.WriteLine(BetifalGair.Name+"送你巧克力");
20 | }
21 |
22 | public void Flower()
23 | {
24 | Console.WriteLine(BetifalGair.Name+"送你的小花花");
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ProxyModel/bin/Debug/ProxyModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/bin/Debug/ProxyModel.exe
--------------------------------------------------------------------------------
/ProxyModel/bin/Debug/ProxyModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProxyModel/bin/Debug/ProxyModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/bin/Debug/ProxyModel.pdb
--------------------------------------------------------------------------------
/ProxyModel/bin/Debug/ProxyModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/bin/Debug/ProxyModel.vshost.exe
--------------------------------------------------------------------------------
/ProxyModel/bin/Debug/ProxyModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProxyModel/bin/Debug/ProxyModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ProxyModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/ProxyModel/obj/Debug/ProxyModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\ProxyModel\bin\Debug\ProxyModel.exe.config
2 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\ProxyModel\bin\Debug\ProxyModel.exe
3 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\ProxyModel\bin\Debug\ProxyModel.pdb
4 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\ProxyModel\obj\Debug\ProxyModel.exe
5 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\ProxyModel\obj\Debug\ProxyModel.pdb
6 |
--------------------------------------------------------------------------------
/ProxyModel/obj/Debug/ProxyModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/obj/Debug/ProxyModel.exe
--------------------------------------------------------------------------------
/ProxyModel/obj/Debug/ProxyModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/obj/Debug/ProxyModel.pdb
--------------------------------------------------------------------------------
/ProxyModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/ProxyModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/ProxyModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/ProxyModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/SimpleFactory/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SimpleFactory/Operation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace SimpleFactory
8 | {
9 | public class Operation
10 | {
11 | public double NumberA { get; set; }
12 | public double NumberB { get; set; }
13 | public virtual double GetResult()
14 | {
15 | double result = 0;
16 | return result;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/SimpleFactory/OperationAdd.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace SimpleFactory
8 | {
9 | public class OperationAdd:Operation
10 | {
11 | public override double GetResult()
12 | {
13 | return NumberA + NumberB;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/SimpleFactory/OperationFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace SimpleFactory
8 | {
9 | //运算gong
10 | public class OperationFactory
11 | {
12 | public static Operation CreateOperate(string operate)
13 | {
14 | Operation oper = null;
15 | switch (operate)
16 | {
17 | case"+":
18 | oper = new OperationAdd();
19 | break;
20 | }
21 | return oper;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/SimpleFactory/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace SimpleFactory
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //Operation作为一个父类,也相当于一个接口,子类去实现他们的共同功能
14 | //然后通过简单工厂来生产出不同的产品。最后通过得到的产品去调用他们的行为方法
15 | Operation oper;
16 | oper=OperationFactory.CreateOperate("+");
17 | oper.NumberA = 3;
18 | oper.NumberB = 4;
19 | Console.WriteLine(oper.GetResult());
20 | //UML简介
21 | //1.在UML中,【+】代表着public,【-】代表着prvite,【#】代表着protend
22 | //2.如果A类继承了B类我们用【空心的三角形+实线】表示
23 | //3.如果A类实现了接口,则我们用【空心的三角形+虚线】来表示
24 | //4.如果我们在A类中需要"知道"另外的一个类时我们就用关联,关联的关系我们用【实线箭头】来表示
25 | //5.聚合关系:表示一种弱的引用关系,体现的是A对象可以包含B对象,但B对象不是A对象的一部分(大雁-雁群),他们的生命周期不一样【空心的菱形+实线箭头来表示】
26 | //6.合成【组合】关系:是一种强的"拥有关系",体现了严格的部分和整体的关系,整体和部分的生命周期一样。(鸟-翅膀)【实心的菱形+实线箭头】来表示。
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/SimpleFactory/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("SimpleFactory")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SimpleFactory")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("72841e0b-9018-4cd4-ba7e-030ab0ab167b")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SimpleFactory/SimpleFactory.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {72841E0B-9018-4CD4-BA7E-030AB0AB167B}
8 | Exe
9 | Properties
10 | SimpleFactory
11 | SimpleFactory
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
63 |
--------------------------------------------------------------------------------
/SimpleFactory/bin/Debug/SimpleFactory.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/bin/Debug/SimpleFactory.exe
--------------------------------------------------------------------------------
/SimpleFactory/bin/Debug/SimpleFactory.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SimpleFactory/bin/Debug/SimpleFactory.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/bin/Debug/SimpleFactory.pdb
--------------------------------------------------------------------------------
/SimpleFactory/bin/Debug/SimpleFactory.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/bin/Debug/SimpleFactory.vshost.exe
--------------------------------------------------------------------------------
/SimpleFactory/bin/Debug/SimpleFactory.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SimpleFactory/bin/Debug/SimpleFactory.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SimpleFactory/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/SimpleFactory/obj/Debug/SimpleFactory.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\users\administrator\documents\visual studio 2015\Projects\UML\SimpleFactory\bin\Debug\SimpleFactory.exe.config
2 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\SimpleFactory\bin\Debug\SimpleFactory.exe
3 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\SimpleFactory\bin\Debug\SimpleFactory.pdb
4 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\SimpleFactory\obj\Debug\SimpleFactory.exe
5 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\SimpleFactory\obj\Debug\SimpleFactory.pdb
6 |
--------------------------------------------------------------------------------
/SimpleFactory/obj/Debug/SimpleFactory.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/obj/Debug/SimpleFactory.exe
--------------------------------------------------------------------------------
/SimpleFactory/obj/Debug/SimpleFactory.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/obj/Debug/SimpleFactory.pdb
--------------------------------------------------------------------------------
/SimpleFactory/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/SimpleFactory/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/SimpleFactory/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/SimpleFactory/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/Singleton/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Singleton/Context.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Singleton
8 | {
9 | public class Context
10 | {
11 | private static Context context { get; set; }
12 | private Context()
13 | {
14 |
15 | }
16 | public static Context CreateInstence()
17 | {
18 | if (context==null)
19 | {
20 | context = new Context();
21 | }
22 | return context;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Singleton/MultiSingle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Singleton
8 | {
9 | public class MultiSingle
10 | {
11 | private static MultiSingle multiSingle;
12 | private static object obj = new object();
13 | private MultiSingle() { }
14 | public static MultiSingle Create()
15 | {
16 | if (multiSingle == null)
17 | {
18 | //在这里我们为什么需要锁住另外创建的对象而我们不直接锁住mutiSingle
19 | //因为我们知道这个实例可能根本就没有我们如何锁它.
20 | lock (obj)
21 | {
22 | if (multiSingle == null)
23 | {
24 | multiSingle = new MultiSingle();
25 | }
26 | }
27 | }
28 | return multiSingle;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Singleton/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Singleton
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //单例模式:只允许对象只能是实例化一次,我们将他的构造函数定义为私有的时候外部就不能够实例化该对象,但是外部我们又不能直接的实例化,我们知道Privite内部是可以
14 | //被调用的,于是我们可以在他的内部中调用其对应的方法来创建它的对象,这样我们就可可以实现对象只被实例化一次。
15 | //Context contex = new Context();显然我们这里是不能编译通过的
16 | Context context=Context.CreateInstence();//这样我们就实现了单例模式,该对象在实例化的过程中创建出来的对象和之前的是一样的。但是这种存在着弊病
17 | //那就是在单线程的时候我们确实能够保证对象的唯一,但是针对于多线程我们并不能保证它是唯一的。
18 |
19 | //多线程下的单例模式(lock)
20 | MultiSingle.Create();
21 |
22 | //在C#与公共语言运行库提供了一种"静态初始化",这种方法不需要开发人员显示的编写线程安全代码
23 | SingleTon sig1=SingleTon.GetObj();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Singleton/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Singleton")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Singleton")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("f4aa7526-2821-4430-a77d-8053f9908190")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Singleton/SingleTon.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Singleton
8 | {
9 | //静态初始化
10 | //这里我们用到了Sealed:密封类,就禁止了它派生出更多的类
11 | public sealed class SingleTon
12 | {
13 | public static readonly SingleTon single = new SingleTon();
14 | private SingleTon() { }
15 | public static SingleTon GetObj()
16 | {
17 | return single;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Singleton/Singleton.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F4AA7526-2821-4430-A77D-8053F9908190}
8 | Exe
9 | Properties
10 | Singleton
11 | Singleton
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
63 |
--------------------------------------------------------------------------------
/Singleton/bin/Debug/Singleton.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/bin/Debug/Singleton.exe
--------------------------------------------------------------------------------
/Singleton/bin/Debug/Singleton.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Singleton/bin/Debug/Singleton.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/bin/Debug/Singleton.pdb
--------------------------------------------------------------------------------
/Singleton/bin/Debug/Singleton.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/bin/Debug/Singleton.vshost.exe
--------------------------------------------------------------------------------
/Singleton/bin/Debug/Singleton.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Singleton/bin/Debug/Singleton.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Singleton/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Singleton/obj/Debug/Singleton.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\Singleton\bin\Debug\Singleton.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\Singleton\bin\Debug\Singleton.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\Singleton\bin\Debug\Singleton.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\Singleton\obj\Debug\Singleton.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\Singleton\obj\Debug\Singleton.pdb
6 |
--------------------------------------------------------------------------------
/Singleton/obj/Debug/Singleton.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/obj/Debug/Singleton.exe
--------------------------------------------------------------------------------
/Singleton/obj/Debug/Singleton.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/obj/Debug/Singleton.pdb
--------------------------------------------------------------------------------
/Singleton/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/Singleton/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/Singleton/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/Singleton/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/StatusModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/StatusModel/ConcreteState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class ConcreteStateA : State
10 | {
11 | public override void Handle(Context context)
12 | {
13 | context.State = new ConcreteStateB();
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/StatusModel/ConcreteStateB.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | class ConcreteStateB : State
10 | {
11 | public override void Handle(Context context)
12 | {
13 | context.State = new ConcreteStateA();
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/StatusModel/Context.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class Context
10 | {
11 | private State state;
12 | public State State
13 | {
14 | //设置可读写的的状态属性,用于读取当前状态和设置新状态
15 | get { return state; }
16 | set {
17 | state = value;
18 | Console.WriteLine($"当前状态{state.GetType().Name}");
19 | }
20 | }
21 | public Context(State state)
22 | {
23 | //定义Context的初始状态
24 | this.state = state;
25 | }
26 | public void Request()
27 | {
28 | //对请求做处理,并设置下一状态
29 | state.Handle(this);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/StatusModel/Demo/DayContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel.Demo
8 | {
9 | public class DayContext
10 | {
11 | public int Hour { get; set; }
12 | public DayState DayState { get; set; }
13 | public DayContext(DayState DayState)
14 | {
15 | this.DayState = DayState;
16 | }
17 | public void Request()
18 | {
19 | DayState.Handler(this);
20 | }
21 | public void SetVal(int hour)
22 | {
23 | this.Hour = hour;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/StatusModel/Demo/DayState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel.Demo
8 | {
9 | public abstract class DayState
10 | {
11 | public abstract void Handler(DayContext context);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/StatusModel/Demo/Monthing.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel.Demo
8 | {
9 | public class Monthing : DayState
10 | {
11 | public override void Handler(DayContext context)
12 | {
13 | if (context.Hour > 6 & context.Hour < 9)
14 | {
15 | Console.WriteLine("起床了!");
16 | }
17 | else if (context.Hour > 10&context.Hour<12)
18 | {
19 | Console.WriteLine("上班了");
20 | }
21 | else
22 | {
23 | try
24 | {
25 | throw new Exception("不在状态时间!");
26 | }
27 | catch (Exception ex)
28 | {
29 | Console.WriteLine(ex.Message);
30 | }
31 |
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/StatusModel/FailState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class FailState : LoginState
10 | {
11 | public override void Handler(LoginContext context)
12 | {
13 | if (context.UserName!="1234")
14 | {
15 | Console.WriteLine("失败!");
16 | }
17 | else
18 | {
19 | context.State = new SuccessState();
20 | context.Request();
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/StatusModel/ForenoonState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class ForenoonState : WorkState
10 | {
11 | public override void Handler(WorkContext context)
12 | {
13 | if (context.Hour > 12)
14 | {
15 | Console.WriteLine("当前为下午时间");
16 | }
17 | else
18 | {
19 | context.State = new MorningState();
20 | context.Request();
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/StatusModel/LightContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class LightContext
10 | {
11 | public LightState State { get; set; }
12 | public LightContext(LightState state)
13 | {
14 | this.State = state;
15 | }
16 | public void Request()
17 | {
18 | State.Handler(this);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/StatusModel/LightOff.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class LightOff : LightState
10 | {
11 | public override void Handler(LightContext context)
12 | {
13 | context.State = new LightOn();
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/StatusModel/LightOn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class LightOn : LightState
10 | {
11 | public override void Handler(LightContext context)
12 | {
13 | context.State = new LightOff();
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/StatusModel/LightState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public abstract class LightState
10 | {
11 | public abstract void Handler(LightContext context);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/StatusModel/LoginContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class LoginContext
10 | {
11 | public LoginState State { get; set; }
12 | public string UserName { get; set; }
13 | public LoginContext(LoginState state)
14 | {
15 | this.State = state;
16 | }
17 | public void Request()
18 | {
19 | State.Handler(this);
20 | }
21 | public void SetValue(string userName)
22 | {
23 | this.UserName = userName;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/StatusModel/LoginState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public abstract class LoginState
10 | {
11 | public abstract void Handler(LoginContext context);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/StatusModel/MorningState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class MorningState : WorkState
10 | {
11 | public override void Handler(WorkContext context)
12 | {
13 | if (context.Hour <= 12)
14 | {
15 | Console.WriteLine("当前为早上时间!");
16 | }
17 | else
18 | {
19 | context.State = new ForenoonState();
20 | context.Request();
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/StatusModel/Program.cs:
--------------------------------------------------------------------------------
1 | using StatusModel.Demo;
2 | using StatusModel.Project;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace StatusModel
10 | {
11 | class Program
12 | {
13 | static void Main(string[] args)
14 | {
15 | //状态模式
16 | //Context c = new Context(new ConcreteStateA());
17 | //c.Request();
18 | //c.Request();
19 | //c.Request();
20 | //LoginContext context = new LoginContext(new FailState());
21 | //context.SetValue("1234");
22 | //context.Request();
23 | //context.SetValue("234");
24 | //context.Request();
25 |
26 | //DayContext context = new DayContext(new Monthing());
27 | //context.SetVal(15);
28 | //context.Request();
29 |
30 | WorkContexted context = new WorkContexted(new WorkingState());
31 | context.SetValue(9);
32 | context.Request();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/StatusModel/Project/WorkContexted.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel.Project
8 | {
9 | public class WorkContexted
10 | {
11 | public int Hour { get; set; }
12 | public WorkStates State { get; set; }
13 | public WorkContexted(WorkStates state)
14 | {
15 | this.State = state;
16 | }
17 | public void SetValue(int hour)
18 | {
19 | this.Hour = hour;
20 | }
21 | public void Request()
22 | {
23 | State.Show(this);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/StatusModel/Project/WorkStates.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel.Project
8 | {
9 | public abstract class WorkStates
10 | {
11 | public abstract void Show(WorkContexted context);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/StatusModel/Project/WorkedState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel.Project
8 | {
9 | public class WorkedState : WorkStates
10 | {
11 | public override void Show(WorkContexted context)
12 | {
13 | if (context.Hour < 10)
14 | {
15 | Console.WriteLine("下班!");
16 | }
17 | else
18 | {
19 | new WorkContexted(new WorkingState()).Request();
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/StatusModel/Project/WorkingState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel.Project
8 | {
9 | public class WorkingState : WorkStates
10 | {
11 | public override void Show(WorkContexted context)
12 | {
13 | if (context.Hour > 10)
14 | {
15 | Console.WriteLine("上班!");
16 | }
17 | else
18 | {
19 | new WorkContexted(new WorkedState()).Request();
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/StatusModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("StatusModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("StatusModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("55bf0527-af01-408e-9a28-675694f21119")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/StatusModel/State.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public abstract class State
10 | {
11 | public abstract void Handle(Context context);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/StatusModel/SuccessState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class SuccessState : LoginState
10 | {
11 | public override void Handler(LoginContext context)
12 | {
13 | if (context.UserName == "1234")
14 | {
15 | Console.WriteLine("成功");
16 | }
17 | else
18 | {
19 | context.State = new FailState();
20 | context.Request();
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/StatusModel/WorkContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public class WorkContext
10 | {
11 | public int Hour { get; set; }
12 | public WorkState State { get; set; }
13 | public WorkContext(WorkState state)
14 | {
15 | this.State = state;
16 | this.Hour = 0;
17 | }
18 | public void Request()
19 | {
20 | State.Handler(this);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/StatusModel/WorkState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StatusModel
8 | {
9 | public abstract class WorkState
10 | {
11 | public abstract void Handler(WorkContext context);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/StatusModel/bin/Debug/StatusModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/bin/Debug/StatusModel.exe
--------------------------------------------------------------------------------
/StatusModel/bin/Debug/StatusModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/StatusModel/bin/Debug/StatusModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/bin/Debug/StatusModel.pdb
--------------------------------------------------------------------------------
/StatusModel/bin/Debug/StatusModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/bin/Debug/StatusModel.vshost.exe
--------------------------------------------------------------------------------
/StatusModel/bin/Debug/StatusModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/StatusModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/StatusModel/obj/Debug/StatusModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StatusModel\bin\Debug\StatusModel.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StatusModel\bin\Debug\StatusModel.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StatusModel\bin\Debug\StatusModel.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StatusModel\obj\Debug\StatusModel.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StatusModel\obj\Debug\StatusModel.pdb
6 | C:\Users\Administrator\Documents\visual studio 2015\Projects\UML\StatusModel\obj\Debug\StatusModel.csprojResolveAssemblyReference.cache
7 |
--------------------------------------------------------------------------------
/StatusModel/obj/Debug/StatusModel.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/obj/Debug/StatusModel.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/StatusModel/obj/Debug/StatusModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/obj/Debug/StatusModel.exe
--------------------------------------------------------------------------------
/StatusModel/obj/Debug/StatusModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/obj/Debug/StatusModel.pdb
--------------------------------------------------------------------------------
/StatusModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/StatusModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/StatusModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StatusModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/StrategyModel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/StrategyModel/ConcreteStrategyA.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StrategyModel
8 | {
9 | public class ConcreteStrategyA:Strategy
10 | {
11 | public override void AlgoristhmInterface()
12 | {
13 | Console.WriteLine("实现算法A");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/StrategyModel/ConcreteStrategyB.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StrategyModel
8 | {
9 | public class ConcreteStrategyB:Strategy
10 | {
11 | public override void AlgoristhmInterface()
12 | {
13 | Console.WriteLine("实现算法B");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/StrategyModel/Context.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StrategyModel
8 | {
9 | //使用Context上下文用一个ConcreteStrategy来配置,维护一个对Strategy对象的引用
10 | public class Context
11 | {
12 | public Strategy strategy { get; set; }
13 | //初始化的时候传入策略对象
14 | //改造前:
15 | //public Context(Strategy strategy)
16 | //{
17 | // this.strategy = strategy;
18 | //}
19 | //改造后,用户是需要传入参数就可以的到具体对象,调用不同的算法,
20 | //这样用户在前台就可以不用认识到多个类型,只需要认识一个就可以实现
21 | public Context(string type)
22 | {
23 | switch (type)
24 | {
25 | case "A":
26 | strategy = new ConcreteStrategyA();
27 | break;
28 | case "B":
29 | strategy = new ConcreteStrategyB();
30 | break;
31 | default:
32 | break;
33 | }
34 | }
35 | //上下文接口
36 | public void ContextInterface()
37 | {
38 | //根据具体的策队对象,调用他对应的算法
39 | strategy.AlgoristhmInterface();
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/StrategyModel/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StrategyModel
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //什么是类?
14 | //面向对象的编程,并不是类越多越好,类的划分是为了封装,但分类的基础是抽象,
15 | //具有相同属性和功能的对象的抽象集合才是类。
16 |
17 | //策略模式:
18 | //它定义了算法家族,分别封装起来,让他们之间可以相互替换,此模式让算法的变化,
19 | //不会影响到使用算法的客户。
20 | Context context;
21 | //通过我们定义的上下文Context传入的对象调用他对应的方法
22 | //但是我们发现在客服端,会认识到两个类,我们就可以与之前抽象工厂相结合,让用户只认识到一个类
23 | //改造前:
24 | //context = new Context(new ConcreteStrategyA());
25 | //context.ContextInterface();
26 | //改造后:
27 | context = new Context("A");
28 | context.ContextInterface();
29 |
30 | //也许你会疑惑,简单工厂和策略模式到底有什么区别呢?看起来都一样啊!
31 | //这是我的一些理解
32 | //1.简单工厂模式:客服端传入一个条件进入工厂类中,工厂类根据条件创建相应的产品创建出对象,
33 | //并Return给客服端,供客户端使用,即客服端使用的是工厂类生产的产品对象。
34 |
35 | //2.策略模式:客服端穿件一个Context类对象A(可以看作工厂模式中的工厂类),
36 | //创建一个策略对象并传递并传参给对象A,然后客服端使用A对象的某些方法调用前面参数传进来的策略,即
37 | //客服端是通过A对象来使用策略。
38 |
39 | //3.为什么两种模式需要结合使用?
40 | //通过前面的介绍我们可以了解到,简单工厂总的来说就是通过条件创建出具体的对象,而策略模式从侧面来讲他跟简单工厂有着那么几分相识
41 | //他的工厂类是通过传入的对象来具体的方法,从上面的代码我们发现,如果单一的使用策略模式我们会发现这样客服端就需要认识到两个类,这样耦合性就降低了
42 | //所以我们就可以将策略模式中Context改造,在他里面具体实例化,而不需要在客户端进行实例化。从而就达到了我们所要的效果。
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/StrategyModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("StrategyModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("StrategyModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("2998a301-ca0b-4501-a8b5-29c87953d198")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/StrategyModel/Strategy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace StrategyModel
8 | {
9 | //抽象算法类
10 | public abstract class Strategy
11 | {
12 | //定义方法
13 | public abstract void AlgoristhmInterface();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/StrategyModel/StrategyModel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {2998A301-CA0B-4501-A8B5-29C87953D198}
8 | Exe
9 | Properties
10 | StrategyModel
11 | StrategyModel
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/StrategyModel/bin/Debug/StrategyModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/bin/Debug/StrategyModel.exe
--------------------------------------------------------------------------------
/StrategyModel/bin/Debug/StrategyModel.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/StrategyModel/bin/Debug/StrategyModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/bin/Debug/StrategyModel.pdb
--------------------------------------------------------------------------------
/StrategyModel/bin/Debug/StrategyModel.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/bin/Debug/StrategyModel.vshost.exe
--------------------------------------------------------------------------------
/StrategyModel/bin/Debug/StrategyModel.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/StrategyModel/bin/Debug/StrategyModel.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/StrategyModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/StrategyModel/obj/Debug/StrategyModel.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StrategyModel\bin\Debug\StrategyModel.exe.config
2 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StrategyModel\bin\Debug\StrategyModel.exe
3 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StrategyModel\bin\Debug\StrategyModel.pdb
4 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StrategyModel\obj\Debug\StrategyModel.exe
5 | c:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\StrategyModel\obj\Debug\StrategyModel.pdb
6 |
--------------------------------------------------------------------------------
/StrategyModel/obj/Debug/StrategyModel.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/obj/Debug/StrategyModel.exe
--------------------------------------------------------------------------------
/StrategyModel/obj/Debug/StrategyModel.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/obj/Debug/StrategyModel.pdb
--------------------------------------------------------------------------------
/StrategyModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/StrategyModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/StrategyModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/StrategyModel/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/TemplateMethod/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TemplateMethod/Person.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TemplateMethod
8 | {
9 | public abstract class Person
10 | {
11 | public string Name { get; set; }
12 | public void Eat()
13 | {
14 | Console.WriteLine($"我叫{Name},我最想吃{WantEat()}");
15 | }
16 | public void Drink()
17 | {
18 | Console.WriteLine($"我叫{Name},我最想喝{WantDink()}");
19 | }
20 | public void Sleep()
21 | {
22 | Console.WriteLine($"我叫{Name},我想睡睡觉{WantSleep()}");
23 | }
24 | public Person()
25 | {
26 | this.Name = GetName();
27 | }
28 |
29 | public virtual string GetName()
30 | {
31 | return "";
32 | }
33 | public virtual string WantEat()
34 | {
35 | return "";
36 | }
37 | public virtual string WantDink()
38 | {
39 | return "";
40 | }
41 | public virtual string WantSleep()
42 | {
43 | return "";
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/TemplateMethod/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TemplateMethod
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //模板方法:当我们要完成在某一细节层次一致的一个过程或者一个步骤,但其个别步骤
14 | //在更详细的层次上的实现可能不同时,我们通常考虑用模板方法模式来处理.
15 | //Console.WriteLine("学生A的试卷");
16 | //QuestionFathor one = new StudentOne();
17 | //one.QuestionOne();
18 | //one.QuestionTwo();
19 | //备注:我们既然使用了继承我们在子类中重复的代码就需要上升到父类去,
20 | //而不是让每一个子类都去重复。
21 | Person per = new Student();
22 | per.Drink();
23 | per.Eat();
24 | per.Sleep();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/TemplateMethod/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("TemplateMethod")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TemplateMethod")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("35a7a370-0373-4a29-9357-eb33a1408b75")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/TemplateMethod/QuestionFathor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TemplateMethod
8 | {
9 | public class QuestionFathor
10 | {
11 | public void QuestionOne()
12 | {
13 | Console.WriteLine("面向对象的几个特性?[]a:封装 b:继承 c:多态 d:抽象");
14 | Console.WriteLine($"答案{AnswerOne()}");
15 | }
16 | public void QuestionTwo()
17 | {
18 | Console.WriteLine("String str=new String('3423')实例化了几次?[]a:1次 b:2次 c:3次 d:4次");
19 | Console.WriteLine($"答案{AnswerTwo()}");
20 | }
21 | public virtual string AnswerOne()
22 | {
23 | return "";
24 | }
25 | public virtual string AnswerTwo()
26 | {
27 | return "";
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TemplateMethod/Student.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TemplateMethod
8 | {
9 | public class Student:Person
10 | {
11 | public override string WantSleep()
12 | {
13 | return "6个小时!";
14 | }
15 | public override string WantEat()
16 | {
17 | return "吃大米!";
18 | }
19 | public override string GetName()
20 | {
21 | return "张腾";
22 | }
23 | public override string WantDink()
24 | {
25 | return "芒果汁";
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/TemplateMethod/StudentOne.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TemplateMethod
8 | {
9 | public class StudentOne:QuestionFathor
10 | {
11 | public override string AnswerOne()
12 | {
13 | return "A";
14 | }
15 | public override string AnswerTwo()
16 | {
17 | return "B";
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/TemplateMethod/TemplateMethod.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {35A7A370-0373-4A29-9357-EB33A1408B75}
8 | Exe
9 | Properties
10 | TemplateMethod
11 | TemplateMethod
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/TemplateMethod/bin/Debug/TemplateMethod.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/bin/Debug/TemplateMethod.exe
--------------------------------------------------------------------------------
/TemplateMethod/bin/Debug/TemplateMethod.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TemplateMethod/bin/Debug/TemplateMethod.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/bin/Debug/TemplateMethod.pdb
--------------------------------------------------------------------------------
/TemplateMethod/bin/Debug/TemplateMethod.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/bin/Debug/TemplateMethod.vshost.exe
--------------------------------------------------------------------------------
/TemplateMethod/bin/Debug/TemplateMethod.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TemplateMethod/bin/Debug/TemplateMethod.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/TemplateMethod/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/TemplateMethod/obj/Debug/TemplateMethod.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\TemplateMethod\bin\Debug\TemplateMethod.exe.config
2 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\TemplateMethod\bin\Debug\TemplateMethod.exe
3 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\TemplateMethod\bin\Debug\TemplateMethod.pdb
4 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\TemplateMethod\obj\Debug\TemplateMethod.exe
5 | C:\Users\Administrator\Documents\Visual Studio 2015\Projects\UML\TemplateMethod\obj\Debug\TemplateMethod.pdb
6 |
--------------------------------------------------------------------------------
/TemplateMethod/obj/Debug/TemplateMethod.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/obj/Debug/TemplateMethod.exe
--------------------------------------------------------------------------------
/TemplateMethod/obj/Debug/TemplateMethod.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/obj/Debug/TemplateMethod.pdb
--------------------------------------------------------------------------------
/TemplateMethod/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/TemplateMethod/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/TemplateMethod/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TengXiaoDai/DesignPattern/ef18f6c014a1383a15ed9d9fa4f8b7e1f55e2aa8/TemplateMethod/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------