-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoot.cs
More file actions
37 lines (30 loc) · 1.16 KB
/
Root.cs
File metadata and controls
37 lines (30 loc) · 1.16 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
using System;
using MyGenerics;
using DecouplingBehaviors;
using ObserverExample;
using DecoratorExample;
using FactoryExample;
using SingletonExample;
using CommandExample;
using AdapterExample;
namespace PatternsExamples
{
public class Root
{
enum Patterns { Strategy, Observer, Decorator, Factory, Singleton, Command, Adapter };
public static void Main() {
Patterns toPractice = Patterns.Adapter;
switch (toPractice) {
case Patterns.Strategy: run( new MiniDuckSimulator() ); break;
case Patterns.Observer: run( new WeatherMonitoring() ); break;
case Patterns.Decorator: run( new StarbuzzCoffee() ); break;
case Patterns.Factory: run( new OrderPizza() ); break;
case Patterns.Singleton: run( new Choc_O_Holic() ); break;
case Patterns.Command: run( new RemoteControl() ); break;
case Patterns.Adapter: run( new Adapting() ); break;
}
Console.ReadLine();
}
public static void run(IInitialStep pattern) => pattern.Start();
}
}