Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
172 lines (127 loc) · 3.5 KB
/
Copy pathProgram.cs
File metadata and controls
172 lines (127 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using designPatterns.behaviour;
using designPatterns.Creational;
using designPatterns.Structural;
namespace designPatterns
{
class Program
{
static void Main(string[] args)
{
#region Creational Patterns
//## Factory DP
//CreationDP.FactoryDP();
//## Abstract Factory DP
//CreationDP.AbstractFactoryDP();
//#Prototype DP
//CreationDP.ProtoTypeDP();
//## Singleton DP
//CreationDP.SingletonDP();
//## Builder DP
//CreationDP.BuilderDP();
#endregion
#region Structural
//## Adapter DP
//StructureDP.AdapterDP();
//## Bridge DP
//StructureDP.BridgeDP();
//## Flyweight DP
//Flyweight.Test();
//##Composite DP
//StructureDP.CompositeDP();
//##Decorator DP
//StructureDP.Decorator();
//##Proxy DP
//StructureDP.Proxy();
#endregion
#region Behaviour
//BehavioursDP.ChainOfResp();
//Command Design Pattern
//BehavioursDP.CommandDP();
#endregion
Console.ReadLine();
}
}
/// <summary>
/// Creation Design Patterns
/// </summary>
public static class CreationDP
{
public static void FactoryDP()
{
var fac = new Factory();
fac.Demonstrate();
}
public static void AbstractFactoryDP()
{
ICar car1 = AbstractFactory.CreateCar(1);
ICar car2 = AbstractFactory.CreateCar(2);
Console.WriteLine($"Abstract create car 1 -{car1.GetCarModel()} and car 2 {car2.GetCarModel()}");
}
public static void ProtoTypeDP()
{
var PtDp = new Prototype();
PtDp.Demonstrate();
}
public static void SingletonDP()
{
var sdp = new SingleTon();
sdp.Demonstrate();
}
public static void BuilderDP()
{
var BDP = new Builder();
BDP.Demonstrate();
}
}
public static class StructureDP
{
public static void AdapterDP()
{
var adap = new Adapter();
Console.WriteLine($"the new Adapter value is {adap.GetNewMEthod()}");
}
public static void BridgeDP()
{
var bridge = new Bridge();
bridge.Demonstrate();
}
public static void CompositeDP()
{
var compositeDP = new Composite();
compositeDP.Demonstrate();
}
public static void Facade()
{
var fas = new Facade();
fas.GetTempretureInformation("1000");
}
public static void Proxy()
{
var prox = new Proxy();
prox.demonstrate();
}
public static void Decorator()
{
var decor = new DecoratorDP();
decor.Demonstrate();
}
}
public static class BehavioursDP
{
public static void ChainOfResp()
{
var cOr = new ChainOFResponsabillity();
cOr.Test();
}
public static void CommandDP()
{
var cmd =new Command();
cmd.Demonstrate();
}
}
}