diff --git a/.gitignore b/.gitignore index 3c4efe2..5ee0c0e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ *.userosscache *.sln.docstates + + + # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs @@ -27,6 +30,8 @@ bld/ # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ +# Visual Studio Code cache/options directory +.vscode/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* diff --git a/AdapterPattern/AdapterPattern.csproj b/AdapterPattern/AdapterPattern.csproj index c90d11b..74abf5c 100644 --- a/AdapterPattern/AdapterPattern.csproj +++ b/AdapterPattern/AdapterPattern.csproj @@ -1,57 +1,10 @@ - - - + + - Debug - AnyCPU - {68B119D1-3527-4356-946F-CEA179084C91} Exe - AdapterPattern - AdapterPattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/AdapterPattern/App.config b/AdapterPattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/AdapterPattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/AdapterPattern/MallardDuck.cs b/AdapterPattern/MallardDuck.cs index 24c1ede..b0602cf 100644 --- a/AdapterPattern/MallardDuck.cs +++ b/AdapterPattern/MallardDuck.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace AdapterPattern { diff --git a/AdapterPattern/Program.cs b/AdapterPattern/Program.cs index 3a159fd..cb46974 100644 --- a/AdapterPattern/Program.cs +++ b/AdapterPattern/Program.cs @@ -1,4 +1,5 @@ -namespace AdapterPattern + +namespace AdapterPattern { internal static class Program { diff --git a/AdapterPattern/Properties/AssemblyInfo.cs b/AdapterPattern/Properties/AssemblyInfo.cs deleted file mode 100644 index 6b9c1c7..0000000 --- a/AdapterPattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AdapterPattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AdapterPattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("68b119d1-3527-4356-946f-cea179084c91")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AdapterPattern/TurkeyAdapter.cs b/AdapterPattern/TurkeyAdapter.cs index 708eae1..adf13e0 100644 --- a/AdapterPattern/TurkeyAdapter.cs +++ b/AdapterPattern/TurkeyAdapter.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; namespace AdapterPattern { diff --git a/AdapterPattern/WildTurkey.cs b/AdapterPattern/WildTurkey.cs index 2e79fa7..b6e04ac 100644 --- a/AdapterPattern/WildTurkey.cs +++ b/AdapterPattern/WildTurkey.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace AdapterPattern { diff --git a/BridgePattern/BridgePattern.csproj b/BridgePattern/BridgePattern.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/BridgePattern/BridgePattern.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/BridgePattern/FlyingEnchantment.cs b/BridgePattern/FlyingEnchantment.cs new file mode 100644 index 0000000..4aa5b38 --- /dev/null +++ b/BridgePattern/FlyingEnchantment.cs @@ -0,0 +1,22 @@ +using System; + +namespace BridgePattern +{ + public class FlyingEnchantment : IEnchantment + { + public void OnActivate() + { + Console.WriteLine("The item begins to glow faintly."); + } + + public void Apply() + { + Console.WriteLine("The item flies and strikes the enemies finally returning to owner's hand."); + } + + public void OnDeactivate() + { + Console.WriteLine("The item's glow fades."); + } + } +} \ No newline at end of file diff --git a/BridgePattern/Hammer.cs b/BridgePattern/Hammer.cs new file mode 100644 index 0000000..55e6782 --- /dev/null +++ b/BridgePattern/Hammer.cs @@ -0,0 +1,36 @@ +using System; + +namespace BridgePattern +{ + public class Hammer : IWeapon + { + private readonly IEnchantment _enchantment; + public Hammer(IEnchantment enchantment) + { + _enchantment = enchantment; + } + + public void Wield() + { + Console.WriteLine("The hammer is wielded."); + _enchantment.OnActivate(); + } + + public void Swing() + { + Console.WriteLine("The hammer is swinged."); + _enchantment.Apply(); + } + + public void Unwield() + { + Console.WriteLine("The hammer is unwielded."); + _enchantment.OnDeactivate(); + } + + public IEnchantment GetEnchantment() + { + return _enchantment; + } + } +} \ No newline at end of file diff --git a/BridgePattern/IEnchantment.cs b/BridgePattern/IEnchantment.cs new file mode 100644 index 0000000..6f958ea --- /dev/null +++ b/BridgePattern/IEnchantment.cs @@ -0,0 +1,9 @@ +namespace BridgePattern +{ + public interface IEnchantment + { + void OnActivate(); + void Apply(); + void OnDeactivate(); + } +} \ No newline at end of file diff --git a/BridgePattern/IWeapon.cs b/BridgePattern/IWeapon.cs new file mode 100644 index 0000000..2b2383b --- /dev/null +++ b/BridgePattern/IWeapon.cs @@ -0,0 +1,10 @@ +namespace BridgePattern +{ + public interface IWeapon + { + void Wield(); + void Swing(); + void Unwield(); + IEnchantment GetEnchantment(); + } +} \ No newline at end of file diff --git a/BridgePattern/Program.cs b/BridgePattern/Program.cs new file mode 100644 index 0000000..c07d035 --- /dev/null +++ b/BridgePattern/Program.cs @@ -0,0 +1,18 @@ +namespace BridgePattern +{ + internal static class Program + { + private static void Main() + { + IWeapon sword = new Sword(new FlyingEnchantment()); + sword.Wield(); + sword.Swing(); + sword.Unwield(); + + IWeapon hammer = new Hammer(new SoulEatingEnchantment()); + hammer.Wield(); + hammer.Swing(); + hammer.Unwield(); + } + } +} \ No newline at end of file diff --git a/BridgePattern/SoulEatingEnchantment.cs b/BridgePattern/SoulEatingEnchantment.cs new file mode 100644 index 0000000..dfb9b8a --- /dev/null +++ b/BridgePattern/SoulEatingEnchantment.cs @@ -0,0 +1,22 @@ +using System; + +namespace BridgePattern +{ + public class SoulEatingEnchantment : IEnchantment + { + public void OnActivate() + { + Console.WriteLine("The item spreads bloodlust."); + } + + public void Apply() + { + Console.WriteLine("The item eats the soul of enemies."); + } + + public void OnDeactivate() + { + Console.WriteLine("Bloodlust slowly disappears."); + } + } +} \ No newline at end of file diff --git a/BridgePattern/Sword.cs b/BridgePattern/Sword.cs new file mode 100644 index 0000000..23198d5 --- /dev/null +++ b/BridgePattern/Sword.cs @@ -0,0 +1,37 @@ +using System; + +namespace BridgePattern +{ + public class Sword : IWeapon + { + private readonly IEnchantment _enchantment; + + public Sword(IEnchantment enchantment) + { + _enchantment = enchantment; + } + + public void Wield() + { + Console.WriteLine("The sword is wielded."); + _enchantment.OnActivate(); + } + + public void Swing() + { + Console.WriteLine("The sword is swinged."); + _enchantment.Apply(); + } + + public void Unwield() + { + Console.WriteLine("The sword is unwielded."); + _enchantment.OnDeactivate(); + } + + public IEnchantment GetEnchantment() + { + return _enchantment; + } + } +} \ No newline at end of file diff --git a/BuilderPattern/BuilderPattern.csproj b/BuilderPattern/BuilderPattern.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/BuilderPattern/BuilderPattern.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/BuilderPattern/Cook.cs b/BuilderPattern/Cook.cs new file mode 100644 index 0000000..980bb3d --- /dev/null +++ b/BuilderPattern/Cook.cs @@ -0,0 +1,32 @@ +namespace BuilderPattern +{ + + // This class can also be called the Director + public class Cook + { + private IBuilder _builder; + public Cook(IBuilder builder) + { + AcceptBuilder(builder); + } + + public void ChangeBuilder(IBuilder builder) + { + AcceptBuilder(builder); + } + + public Hamburger Build() + { + _builder.AddIngredients(); + _builder.AddShape(); + _builder.AddSize(); + return _builder.Build(); + } + + private void AcceptBuilder(IBuilder builder) + { + _builder = builder; + _builder.Reset(); + } + } +} diff --git a/BuilderPattern/Hamburger.cs b/BuilderPattern/Hamburger.cs new file mode 100644 index 0000000..68ec0f6 --- /dev/null +++ b/BuilderPattern/Hamburger.cs @@ -0,0 +1,19 @@ + +namespace BuilderPattern +{ + public class Hamburger + { + public int Size { get; set; } + public string Shape { get; set; } + public string[] Ingredients { get; set; } + public override string ToString() + { + var hamburger = ""; + foreach (var ingredient in Ingredients) + { + hamburger += $"{ingredient} "; + } + return $"Ingredients: {hamburger}, Size: {Size}, Shape: {Shape}"; + } + } +} diff --git a/BuilderPattern/IBuilder.cs b/BuilderPattern/IBuilder.cs new file mode 100644 index 0000000..2730841 --- /dev/null +++ b/BuilderPattern/IBuilder.cs @@ -0,0 +1,11 @@ +namespace BuilderPattern +{ + public interface IBuilder + { + void AddIngredients(); + void AddShape(); + void AddSize(); + void Reset(); + Hamburger Build(); + } +} diff --git a/BuilderPattern/MyHamburgerBuilder.cs b/BuilderPattern/MyHamburgerBuilder.cs new file mode 100644 index 0000000..4ce1cbf --- /dev/null +++ b/BuilderPattern/MyHamburgerBuilder.cs @@ -0,0 +1,31 @@ +namespace BuilderPattern +{ + public class MyHamburgerBuilder : IBuilder + { + private Hamburger _hamburger; + public void AddIngredients() + { + _hamburger.Ingredients = new string[] { "Bread", "Meat", "Tomato", "Salad", "Mayonnaise" }; + } + + public void AddShape() + { + _hamburger.Shape = "Kite"; + } + + public void AddSize() + { + _hamburger.Size = 10; //inches + } + public void Reset() + { + _hamburger = new Hamburger(); + } + + public Hamburger Build() + { + return _hamburger; + } + + } +} diff --git a/BuilderPattern/Program.cs b/BuilderPattern/Program.cs new file mode 100644 index 0000000..dc14219 --- /dev/null +++ b/BuilderPattern/Program.cs @@ -0,0 +1,20 @@ +using System; + +namespace BuilderPattern +{ + class Program + { + static void Main() + { + var builder = new MyHamburgerBuilder(); + var cook = new Cook(builder); + var myHamburger = cook.Build(); + + cook.ChangeBuilder(new WifesHamburgerBuilder()); + var wifesHamburger = cook.Build(); + + Console.WriteLine($"My Hamburger: {myHamburger}"); + Console.WriteLine($"My Wife's Hamburger: {wifesHamburger}"); + } + } +} diff --git a/BuilderPattern/WifesHamburgerBuilder.cs b/BuilderPattern/WifesHamburgerBuilder.cs new file mode 100644 index 0000000..887dcc1 --- /dev/null +++ b/BuilderPattern/WifesHamburgerBuilder.cs @@ -0,0 +1,31 @@ +namespace BuilderPattern +{ + + public class WifesHamburgerBuilder : IBuilder + { + private Hamburger _hamburger; + public void AddIngredients() + { + _hamburger.Ingredients = new string[] { "Bread", "Salad" }; + } + + public void AddShape() + { + _hamburger.Shape = "Cuboid"; + } + + public void AddSize() + { + _hamburger.Size = 6; //inches + } + + public void Reset() + { + _hamburger = new Hamburger(); + } + public Hamburger Build() + { + return _hamburger; + } + } +} diff --git a/ChainOfResponsibilityPattern/AdditionHandler.cs b/ChainOfResponsibilityPattern/AdditionHandler.cs new file mode 100644 index 0000000..27f7bbe --- /dev/null +++ b/ChainOfResponsibilityPattern/AdditionHandler.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ChainOfResponsibilityPattern { + public class AdditionHandler : BaseHandler { + public override double? Handle(double[] values, string action) { + if (action.ToLower() == "add") { + double result=0.0; + foreach (var value in values) { + result += value; + } + return result; + } + else { + return _nextInLine?.Handle(values,action); + } + } + } +} diff --git a/ChainOfResponsibilityPattern/BaseHandler.cs b/ChainOfResponsibilityPattern/BaseHandler.cs new file mode 100644 index 0000000..b24a593 --- /dev/null +++ b/ChainOfResponsibilityPattern/BaseHandler.cs @@ -0,0 +1,11 @@ +namespace ChainOfResponsibilityPattern { + public abstract class BaseHandler : IHandler { + public void AddChain(IHandler handler) { + _nextInLine = handler; + } + + public abstract double? Handle(double[] values, string action); + + protected IHandler _nextInLine; + } +} diff --git a/ChainOfResponsibilityPattern/ChainOfResponsibilityPattern.csproj b/ChainOfResponsibilityPattern/ChainOfResponsibilityPattern.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/ChainOfResponsibilityPattern/ChainOfResponsibilityPattern.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/ChainOfResponsibilityPattern/IHandler.cs b/ChainOfResponsibilityPattern/IHandler.cs new file mode 100644 index 0000000..f263adb --- /dev/null +++ b/ChainOfResponsibilityPattern/IHandler.cs @@ -0,0 +1,6 @@ +namespace ChainOfResponsibilityPattern { + public interface IHandler { + void AddChain(IHandler handler); + double? Handle(double[] values, string action); + } +} diff --git a/ChainOfResponsibilityPattern/MultiplicationHandler.cs b/ChainOfResponsibilityPattern/MultiplicationHandler.cs new file mode 100644 index 0000000..cf99553 --- /dev/null +++ b/ChainOfResponsibilityPattern/MultiplicationHandler.cs @@ -0,0 +1,16 @@ +namespace ChainOfResponsibilityPattern { + public class MultiplicationHandler : BaseHandler { + public override double? Handle(double[] values, string action) { + if (action.ToLower() == "multiply") { + var result = 1.0; + foreach (var value in values) { + result *= value; + } + return result; + } + else { + return _nextInLine?.Handle(values, action); + } + } + } +} diff --git a/ChainOfResponsibilityPattern/Program.cs b/ChainOfResponsibilityPattern/Program.cs new file mode 100644 index 0000000..2ea5d2d --- /dev/null +++ b/ChainOfResponsibilityPattern/Program.cs @@ -0,0 +1,26 @@ +using System; + +namespace ChainOfResponsibilityPattern { + class Program { + static void Main(string[] args) { + //create handlers + var additionHandler = new AdditionHandler(); + var subtractionHandler = new SubtractionHandler(); + var multiplicationHander = new MultiplicationHandler(); + //create chain + subtractionHandler.AddChain(multiplicationHander); + additionHandler.AddChain(subtractionHandler); + //Execution + double[] numbers = new double[] { 2, 3, 4, 5 }; + var additionResult = additionHandler.Handle(numbers, "Add"); + var subtractionResult = additionHandler.Handle(numbers, "Minus"); + var multResult = additionHandler.Handle(numbers, "Multiply"); + var divisionResult = additionHandler.Handle(numbers, "divide"); // Divide is not in the chain!!! + + Console.WriteLine("Addition = {0}",additionResult); + Console.WriteLine("Subtraction = {0}", subtractionResult); + Console.WriteLine("Multiplication = {0}", multResult); + Console.WriteLine("Division = {0}", divisionResult); + } + } +} diff --git a/ChainOfResponsibilityPattern/SubtractionHandler.cs b/ChainOfResponsibilityPattern/SubtractionHandler.cs new file mode 100644 index 0000000..7a5e5dd --- /dev/null +++ b/ChainOfResponsibilityPattern/SubtractionHandler.cs @@ -0,0 +1,16 @@ +namespace ChainOfResponsibilityPattern { + public class SubtractionHandler : BaseHandler { + public override double? Handle(double[] values, string action) { + if (action.ToLower() == "minus") { + var result = values[0]; + for (int i = 1; i < values.Length; i++) { + result -= values[i]; + } + return result; + } + else { + return _nextInLine?.Handle(values, action); + } + } + } +} diff --git a/CommandPattern/App.config b/CommandPattern/App.config deleted file mode 100644 index 51fffc7..0000000 --- a/CommandPattern/App.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/CommandPattern/CommandPattern.csproj b/CommandPattern/CommandPattern.csproj index 1d6b215..74abf5c 100644 --- a/CommandPattern/CommandPattern.csproj +++ b/CommandPattern/CommandPattern.csproj @@ -1,57 +1,10 @@ - - - + + - Debug - AnyCPU - {8F58357D-C54F-4C07-A951-8A93B0520187} Exe - CommandPattern - CommandPattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/CommandPattern/Program.cs b/CommandPattern/Program.cs index d12a569..d719ca9 100644 --- a/CommandPattern/Program.cs +++ b/CommandPattern/Program.cs @@ -33,11 +33,11 @@ private static void Main() Console.WriteLine(); var light = new Light("Hall"); - ICommand[] partyOn = {new LightOffCommand(light), bikeDoorOpen, carDoorOpen}; - ICommand[] partyOff = {new LightOnCommand(light), bikeDoorClose, carDoorClose}; + ICommand[] partyOn = { new LightOffCommand(light), bikeDoorOpen, carDoorOpen }; + ICommand[] partyOff = { new LightOnCommand(light), bikeDoorClose, carDoorClose }; - remote[2] = new OnOffStruct {On = new MacroCommand(partyOn), Off = new MacroCommand(partyOff)}; + remote[2] = new OnOffStruct { On = new MacroCommand(partyOn), Off = new MacroCommand(partyOff) }; try { diff --git a/CommandPattern/Properties/AssemblyInfo.cs b/CommandPattern/Properties/AssemblyInfo.cs deleted file mode 100644 index a23cf81..0000000 --- a/CommandPattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("CommandPattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CommandPattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly: Guid("8f58357d-c54f-4c07-a951-8a93b0520187")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/CompositePattern/App.config b/CompositePattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/CompositePattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/CompositePattern/CompositePattern.csproj b/CompositePattern/CompositePattern.csproj index 0baed4b..74abf5c 100644 --- a/CompositePattern/CompositePattern.csproj +++ b/CompositePattern/CompositePattern.csproj @@ -1,56 +1,10 @@ - - - + + - Debug - AnyCPU - {0D5AA731-03F0-4CF6-AEA3-254F06472911} Exe - CompositePattern - CompositePattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/CompositePattern/Menu.cs b/CompositePattern/Menu.cs index 5049303..6be36c6 100644 --- a/CompositePattern/Menu.cs +++ b/CompositePattern/Menu.cs @@ -26,7 +26,7 @@ public override void Remove(MenuComponent component) public override MenuComponent GetChild(int i) { - return _components[i]; + return _components[i]; } public override string Name { get; } diff --git a/CompositePattern/MenuComponent.cs b/CompositePattern/MenuComponent.cs index 07c8c03..38928e4 100644 --- a/CompositePattern/MenuComponent.cs +++ b/CompositePattern/MenuComponent.cs @@ -6,7 +6,7 @@ public class MenuComponent { public virtual void Add(MenuComponent component) { - throw new NotImplementedException(); + throw new NotImplementedException(); } public virtual void Remove(MenuComponent component) diff --git a/CompositePattern/MenuItem.cs b/CompositePattern/MenuItem.cs index 50222e8..ab7c2f1 100644 --- a/CompositePattern/MenuItem.cs +++ b/CompositePattern/MenuItem.cs @@ -18,7 +18,7 @@ public MenuItem(string name, string description, double price, bool isveg) public override double Price { get; } - public override bool Vegetarian { get; } + public override bool Vegetarian { get; } public override void Print() { diff --git a/CompositePattern/Program.cs b/CompositePattern/Program.cs index ea24810..1c24613 100644 --- a/CompositePattern/Program.cs +++ b/CompositePattern/Program.cs @@ -7,14 +7,14 @@ public static void Main() var breakfast = new Menu("Breakfast", "Pancake House"); var lunch = new Menu("Lunch", "Deli Diner"); - var dinner = new Menu("Dinner","Dinneroni"); + var dinner = new Menu("Dinner", "Dinneroni"); var dessert = new Menu("Dessert", "Ice Cream"); var menu = new Menu("All", "McDonalds"); - breakfast.Add(new MenuItem("Waffles","Butterscotch waffles",140,false)); - breakfast.Add(new MenuItem("Corn Flakes","Kellogs",80,true)); + breakfast.Add(new MenuItem("Waffles", "Butterscotch waffles", 140, false)); + breakfast.Add(new MenuItem("Corn Flakes", "Kellogs", 80, true)); lunch.Add(new MenuItem("Burger", "Cheese and Onion Burger", 250, true)); lunch.Add(new MenuItem("Sandwich", "Chicken Sandwich", 280, false)); @@ -23,7 +23,7 @@ public static void Main() dinner.Add(new MenuItem("Pasta", "Chicken Pasta", 280, false)); dessert.Add(new MenuItem("Ice Cream", "Vanilla and Chocolate", 120, true)); - dessert.Add(new MenuItem("Cake", "Choclate Cake Slice",180, false)); + dessert.Add(new MenuItem("Cake", "Choclate Cake Slice", 180, false)); dinner.Add(dessert); menu.Add(breakfast); diff --git a/CompositePattern/Properties/AssemblyInfo.cs b/CompositePattern/Properties/AssemblyInfo.cs deleted file mode 100644 index 553b29b..0000000 --- a/CompositePattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("CompositePattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CompositePattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0d5aa731-03f0-4cf6-aea3-254f06472911")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DecoratorPattern/App.config b/DecoratorPattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/DecoratorPattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/DecoratorPattern/DecoratorPattern.csproj b/DecoratorPattern/DecoratorPattern.csproj index 713eb78..74abf5c 100644 --- a/DecoratorPattern/DecoratorPattern.csproj +++ b/DecoratorPattern/DecoratorPattern.csproj @@ -1,59 +1,10 @@ - - - + + - Debug - AnyCPU - {6E63BDD0-01A4-4A88-8A89-9B45D51B526D} Exe - DecoratorPattern - DecoratorPattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/DecoratorPattern/MochaCondiment.cs b/DecoratorPattern/MochaCondiment.cs index ae2b45d..b0e76a5 100644 --- a/DecoratorPattern/MochaCondiment.cs +++ b/DecoratorPattern/MochaCondiment.cs @@ -9,8 +9,9 @@ public MochaCondiment(Beverage beverage) this._beverage = beverage; } - public override string Description { - get + public override string Description + { + get { if (_beverage.Description.StartsWith("Mocha")) { diff --git a/DecoratorPattern/Properties/AssemblyInfo.cs b/DecoratorPattern/Properties/AssemblyInfo.cs deleted file mode 100644 index 8ad6185..0000000 --- a/DecoratorPattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("DecoratorPattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("DecoratorPattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6e63bdd0-01a4-4a88-8a89-9b45d51b526d")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DecoratorPattern/WhipCondiment.cs b/DecoratorPattern/WhipCondiment.cs index 8863b67..550b929 100644 --- a/DecoratorPattern/WhipCondiment.cs +++ b/DecoratorPattern/WhipCondiment.cs @@ -12,7 +12,7 @@ public WhipCondiment(Beverage beverage) public override string Description { get - { + { if (_beverage.Description.StartsWith("Whip")) { return "Double " + _beverage.Description; diff --git a/DesignPatterns.sln b/DesignPatterns.sln deleted file mode 100644 index 29eace1..0000000 --- a/DesignPatterns.sln +++ /dev/null @@ -1,88 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26228.10 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObserverPattern", "ObserverPattern\ObserverPattern.csproj", "{678581C4-15DC-4A01-93CD-76ACBD5B7462}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StrategyPattern", "StrategyPattern\StrategyPattern.csproj", "{1F52949E-3569-44EC-8C1C-870D5B263694}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DecoratorPattern", "DecoratorPattern\DecoratorPattern.csproj", "{6E63BDD0-01A4-4A88-8A89-9B45D51B526D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FactoryPattern", "FactoryPattern\FactoryPattern.csproj", "{D154B3A3-1C97-4B70-AD4F-DC4DB8F52300}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingletonPattern", "SingletonPattern\SingletonPattern.csproj", "{DF749AC5-3277-45B6-B39E-61E7D842B1BA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandPattern", "CommandPattern\CommandPattern.csproj", "{8F58357D-C54F-4C07-A951-8A93B0520187}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdapterPattern", "AdapterPattern\AdapterPattern.csproj", "{68B119D1-3527-4356-946F-CEA179084C91}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FacadePattern", "FacadePattern\FacadePattern.csproj", "{C5CB5821-CC3B-4440-9CB9-A571A5D7B872}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TemplatePattern", "TemplatePattern\TemplatePattern.csproj", "{FCE8A301-EE20-42DB-82DD-47AB0B569BC9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IteratorPattern", "IteratorPattern\IteratorPattern.csproj", "{A3B8C12F-5DAC-4CEA-B039-C2CBD7A5C9AD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompositePattern", "CompositePattern\CompositePattern.csproj", "{0D5AA731-03F0-4CF6-AEA3-254F06472911}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StatePattern", "StatePattern\StatePattern.csproj", "{974FE8E8-7379-4DCC-9D4F-763D60F5E708}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {678581C4-15DC-4A01-93CD-76ACBD5B7462}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {678581C4-15DC-4A01-93CD-76ACBD5B7462}.Debug|Any CPU.Build.0 = Debug|Any CPU - {678581C4-15DC-4A01-93CD-76ACBD5B7462}.Release|Any CPU.ActiveCfg = Release|Any CPU - {678581C4-15DC-4A01-93CD-76ACBD5B7462}.Release|Any CPU.Build.0 = Release|Any CPU - {1F52949E-3569-44EC-8C1C-870D5B263694}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F52949E-3569-44EC-8C1C-870D5B263694}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F52949E-3569-44EC-8C1C-870D5B263694}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F52949E-3569-44EC-8C1C-870D5B263694}.Release|Any CPU.Build.0 = Release|Any CPU - {6E63BDD0-01A4-4A88-8A89-9B45D51B526D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6E63BDD0-01A4-4A88-8A89-9B45D51B526D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6E63BDD0-01A4-4A88-8A89-9B45D51B526D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6E63BDD0-01A4-4A88-8A89-9B45D51B526D}.Release|Any CPU.Build.0 = Release|Any CPU - {D154B3A3-1C97-4B70-AD4F-DC4DB8F52300}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D154B3A3-1C97-4B70-AD4F-DC4DB8F52300}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D154B3A3-1C97-4B70-AD4F-DC4DB8F52300}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D154B3A3-1C97-4B70-AD4F-DC4DB8F52300}.Release|Any CPU.Build.0 = Release|Any CPU - {DF749AC5-3277-45B6-B39E-61E7D842B1BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DF749AC5-3277-45B6-B39E-61E7D842B1BA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DF749AC5-3277-45B6-B39E-61E7D842B1BA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DF749AC5-3277-45B6-B39E-61E7D842B1BA}.Release|Any CPU.Build.0 = Release|Any CPU - {8F58357D-C54F-4C07-A951-8A93B0520187}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8F58357D-C54F-4C07-A951-8A93B0520187}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8F58357D-C54F-4C07-A951-8A93B0520187}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8F58357D-C54F-4C07-A951-8A93B0520187}.Release|Any CPU.Build.0 = Release|Any CPU - {68B119D1-3527-4356-946F-CEA179084C91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {68B119D1-3527-4356-946F-CEA179084C91}.Debug|Any CPU.Build.0 = Debug|Any CPU - {68B119D1-3527-4356-946F-CEA179084C91}.Release|Any CPU.ActiveCfg = Release|Any CPU - {68B119D1-3527-4356-946F-CEA179084C91}.Release|Any CPU.Build.0 = Release|Any CPU - {C5CB5821-CC3B-4440-9CB9-A571A5D7B872}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C5CB5821-CC3B-4440-9CB9-A571A5D7B872}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C5CB5821-CC3B-4440-9CB9-A571A5D7B872}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C5CB5821-CC3B-4440-9CB9-A571A5D7B872}.Release|Any CPU.Build.0 = Release|Any CPU - {FCE8A301-EE20-42DB-82DD-47AB0B569BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FCE8A301-EE20-42DB-82DD-47AB0B569BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FCE8A301-EE20-42DB-82DD-47AB0B569BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FCE8A301-EE20-42DB-82DD-47AB0B569BC9}.Release|Any CPU.Build.0 = Release|Any CPU - {A3B8C12F-5DAC-4CEA-B039-C2CBD7A5C9AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A3B8C12F-5DAC-4CEA-B039-C2CBD7A5C9AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A3B8C12F-5DAC-4CEA-B039-C2CBD7A5C9AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A3B8C12F-5DAC-4CEA-B039-C2CBD7A5C9AD}.Release|Any CPU.Build.0 = Release|Any CPU - {0D5AA731-03F0-4CF6-AEA3-254F06472911}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0D5AA731-03F0-4CF6-AEA3-254F06472911}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0D5AA731-03F0-4CF6-AEA3-254F06472911}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0D5AA731-03F0-4CF6-AEA3-254F06472911}.Release|Any CPU.Build.0 = Release|Any CPU - {974FE8E8-7379-4DCC-9D4F-763D60F5E708}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {974FE8E8-7379-4DCC-9D4F-763D60F5E708}.Debug|Any CPU.Build.0 = Debug|Any CPU - {974FE8E8-7379-4DCC-9D4F-763D60F5E708}.Release|Any CPU.ActiveCfg = Release|Any CPU - {974FE8E8-7379-4DCC-9D4F-763D60F5E708}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/DesignPatternsDotNetCore.sln b/DesignPatternsDotNetCore.sln new file mode 100644 index 0000000..3a7677a --- /dev/null +++ b/DesignPatternsDotNetCore.sln @@ -0,0 +1,302 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32825.248 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdapterPattern", "AdapterPattern\AdapterPattern.csproj", "{79553F75-E8DC-4988-B511-A79CC6A9CDF7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommandPattern", "CommandPattern\CommandPattern.csproj", "{AC6ED373-CE32-41E4-B38A-64B8700E46C9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompositePattern", "CompositePattern\CompositePattern.csproj", "{21754CEF-8885-4EED-91AF-73FF2514553D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DecoratorPattern", "DecoratorPattern\DecoratorPattern.csproj", "{5F9D7DA1-FA5E-477C-87D7-2A131C99D090}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FacadePattern", "FacadePattern\FacadePattern.csproj", "{CCDDFDE2-9958-476C-91DB-9F2907887ADE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IteratorPattern", "IteratorPattern\IteratorPattern.csproj", "{C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ObserverPattern", "ObserverPattern\ObserverPattern.csproj", "{DDE34459-B244-43F9-8DE2-8D1E70CB6609}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SingletonPattern", "SingletonPattern\SingletonPattern.csproj", "{FA82E572-FC03-4C87-86FA-660AF06AA24A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StatePattern", "StatePattern\StatePattern.csproj", "{1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrategyPattern", "StrategyPattern\StrategyPattern.csproj", "{73D240B4-428D-4BC1-BC3C-C14D1D9D806E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TemplatePattern", "TemplatePattern\TemplatePattern.csproj", "{928CD7B2-BB6E-4E07-834E-67B20CA6D698}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BridgePattern", "BridgePattern\BridgePattern.csproj", "{95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlyweightPattern", "FlyweightPattern\FlyweightPattern.csproj", "{0067EFC3-FC8D-4F1A-AA92-12323CAD0200}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisitorPattern", "VisitorPattern\VisitorPattern.csproj", "{871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FactoryPattern", "FactoryPattern\FactoryPattern.csproj", "{182B58DC-6787-4A09-8BCF-87A96737E5A6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrototypePattern", "PrototypePattern\PrototypePattern.csproj", "{2DC00E3D-2099-4C58-B98F-B6B3F285739F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediatorPattern", "MediatorPattern\MediatorPattern.csproj", "{82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuilderPattern", "BuilderPattern\BuilderPattern.csproj", "{274786D8-2E30-40D7-81B5-DFA3872CF9B6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyPattern", "ProxyPattern\ProxyPattern.csproj", "{0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingletonPattern.Tests", "SingletonPattern.Tests\SingletonPattern.Tests.csproj", "{7A21A074-AEBB-4B33-80BA-D7DFBE87A449}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Debug|x64.ActiveCfg = Debug|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Debug|x64.Build.0 = Debug|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Debug|x86.ActiveCfg = Debug|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Debug|x86.Build.0 = Debug|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Release|Any CPU.Build.0 = Release|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Release|x64.ActiveCfg = Release|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Release|x64.Build.0 = Release|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Release|x86.ActiveCfg = Release|Any CPU + {79553F75-E8DC-4988-B511-A79CC6A9CDF7}.Release|x86.Build.0 = Release|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Debug|x64.ActiveCfg = Debug|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Debug|x64.Build.0 = Debug|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Debug|x86.ActiveCfg = Debug|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Debug|x86.Build.0 = Debug|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Release|Any CPU.Build.0 = Release|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Release|x64.ActiveCfg = Release|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Release|x64.Build.0 = Release|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Release|x86.ActiveCfg = Release|Any CPU + {AC6ED373-CE32-41E4-B38A-64B8700E46C9}.Release|x86.Build.0 = Release|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Debug|x64.ActiveCfg = Debug|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Debug|x64.Build.0 = Debug|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Debug|x86.ActiveCfg = Debug|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Debug|x86.Build.0 = Debug|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Release|Any CPU.Build.0 = Release|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Release|x64.ActiveCfg = Release|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Release|x64.Build.0 = Release|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Release|x86.ActiveCfg = Release|Any CPU + {21754CEF-8885-4EED-91AF-73FF2514553D}.Release|x86.Build.0 = Release|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Debug|x64.ActiveCfg = Debug|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Debug|x64.Build.0 = Debug|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Debug|x86.ActiveCfg = Debug|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Debug|x86.Build.0 = Debug|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Release|Any CPU.Build.0 = Release|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Release|x64.ActiveCfg = Release|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Release|x64.Build.0 = Release|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Release|x86.ActiveCfg = Release|Any CPU + {5F9D7DA1-FA5E-477C-87D7-2A131C99D090}.Release|x86.Build.0 = Release|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Debug|x64.ActiveCfg = Debug|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Debug|x64.Build.0 = Debug|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Debug|x86.ActiveCfg = Debug|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Debug|x86.Build.0 = Debug|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Release|Any CPU.Build.0 = Release|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Release|x64.ActiveCfg = Release|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Release|x64.Build.0 = Release|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Release|x86.ActiveCfg = Release|Any CPU + {CCDDFDE2-9958-476C-91DB-9F2907887ADE}.Release|x86.Build.0 = Release|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Debug|x64.ActiveCfg = Debug|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Debug|x64.Build.0 = Debug|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Debug|x86.ActiveCfg = Debug|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Debug|x86.Build.0 = Debug|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Release|Any CPU.Build.0 = Release|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Release|x64.ActiveCfg = Release|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Release|x64.Build.0 = Release|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Release|x86.ActiveCfg = Release|Any CPU + {C50111DC-B037-4A4C-ACA1-5BDE93F7D42A}.Release|x86.Build.0 = Release|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Debug|x64.ActiveCfg = Debug|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Debug|x64.Build.0 = Debug|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Debug|x86.ActiveCfg = Debug|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Debug|x86.Build.0 = Debug|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Release|Any CPU.Build.0 = Release|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Release|x64.ActiveCfg = Release|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Release|x64.Build.0 = Release|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Release|x86.ActiveCfg = Release|Any CPU + {DDE34459-B244-43F9-8DE2-8D1E70CB6609}.Release|x86.Build.0 = Release|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Debug|x64.ActiveCfg = Debug|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Debug|x64.Build.0 = Debug|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Debug|x86.ActiveCfg = Debug|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Debug|x86.Build.0 = Debug|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Release|Any CPU.Build.0 = Release|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Release|x64.ActiveCfg = Release|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Release|x64.Build.0 = Release|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Release|x86.ActiveCfg = Release|Any CPU + {FA82E572-FC03-4C87-86FA-660AF06AA24A}.Release|x86.Build.0 = Release|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Debug|x64.ActiveCfg = Debug|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Debug|x64.Build.0 = Debug|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Debug|x86.ActiveCfg = Debug|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Debug|x86.Build.0 = Debug|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Release|Any CPU.Build.0 = Release|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Release|x64.ActiveCfg = Release|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Release|x64.Build.0 = Release|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Release|x86.ActiveCfg = Release|Any CPU + {1C0A4103-B8E6-4AE1-88DA-B3EBC37B2441}.Release|x86.Build.0 = Release|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Debug|x64.ActiveCfg = Debug|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Debug|x64.Build.0 = Debug|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Debug|x86.ActiveCfg = Debug|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Debug|x86.Build.0 = Debug|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Release|Any CPU.Build.0 = Release|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Release|x64.ActiveCfg = Release|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Release|x64.Build.0 = Release|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Release|x86.ActiveCfg = Release|Any CPU + {73D240B4-428D-4BC1-BC3C-C14D1D9D806E}.Release|x86.Build.0 = Release|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Debug|Any CPU.Build.0 = Debug|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Debug|x64.ActiveCfg = Debug|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Debug|x64.Build.0 = Debug|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Debug|x86.ActiveCfg = Debug|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Debug|x86.Build.0 = Debug|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Release|Any CPU.ActiveCfg = Release|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Release|Any CPU.Build.0 = Release|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Release|x64.ActiveCfg = Release|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Release|x64.Build.0 = Release|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Release|x86.ActiveCfg = Release|Any CPU + {928CD7B2-BB6E-4E07-834E-67B20CA6D698}.Release|x86.Build.0 = Release|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Debug|x64.ActiveCfg = Debug|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Debug|x64.Build.0 = Debug|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Debug|x86.ActiveCfg = Debug|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Debug|x86.Build.0 = Debug|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Release|Any CPU.Build.0 = Release|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Release|x64.ActiveCfg = Release|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Release|x64.Build.0 = Release|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Release|x86.ActiveCfg = Release|Any CPU + {95E7F42A-74B9-4071-9A3C-86EF95A0EB1B}.Release|x86.Build.0 = Release|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Debug|x64.ActiveCfg = Debug|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Debug|x64.Build.0 = Debug|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Debug|x86.ActiveCfg = Debug|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Debug|x86.Build.0 = Debug|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Release|Any CPU.Build.0 = Release|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Release|x64.ActiveCfg = Release|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Release|x64.Build.0 = Release|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Release|x86.ActiveCfg = Release|Any CPU + {0067EFC3-FC8D-4F1A-AA92-12323CAD0200}.Release|x86.Build.0 = Release|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Debug|Any CPU.Build.0 = Debug|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Debug|x64.ActiveCfg = Debug|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Debug|x64.Build.0 = Debug|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Debug|x86.ActiveCfg = Debug|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Debug|x86.Build.0 = Debug|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Release|Any CPU.Build.0 = Release|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Release|x64.ActiveCfg = Release|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Release|x64.Build.0 = Release|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Release|x86.ActiveCfg = Release|Any CPU + {871F7BE0-B75F-4F9E-9C4D-CE9C4ECE7A88}.Release|x86.Build.0 = Release|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Debug|x64.ActiveCfg = Debug|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Debug|x64.Build.0 = Debug|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Debug|x86.ActiveCfg = Debug|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Debug|x86.Build.0 = Debug|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Release|Any CPU.Build.0 = Release|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Release|x64.ActiveCfg = Release|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Release|x64.Build.0 = Release|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Release|x86.ActiveCfg = Release|Any CPU + {182B58DC-6787-4A09-8BCF-87A96737E5A6}.Release|x86.Build.0 = Release|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Debug|x64.ActiveCfg = Debug|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Debug|x64.Build.0 = Debug|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Debug|x86.ActiveCfg = Debug|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Debug|x86.Build.0 = Debug|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Release|Any CPU.Build.0 = Release|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Release|x64.ActiveCfg = Release|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Release|x64.Build.0 = Release|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Release|x86.ActiveCfg = Release|Any CPU + {2DC00E3D-2099-4C58-B98F-B6B3F285739F}.Release|x86.Build.0 = Release|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Debug|x64.ActiveCfg = Debug|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Debug|x64.Build.0 = Debug|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Debug|x86.ActiveCfg = Debug|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Debug|x86.Build.0 = Debug|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Release|Any CPU.Build.0 = Release|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Release|x64.ActiveCfg = Release|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Release|x64.Build.0 = Release|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Release|x86.ActiveCfg = Release|Any CPU + {82A66FF6-5D66-4E39-8FF8-C8EBA0EB3A2D}.Release|x86.Build.0 = Release|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Debug|x64.ActiveCfg = Debug|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Debug|x64.Build.0 = Debug|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Debug|x86.ActiveCfg = Debug|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Debug|x86.Build.0 = Debug|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Release|Any CPU.Build.0 = Release|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Release|x64.ActiveCfg = Release|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Release|x64.Build.0 = Release|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Release|x86.ActiveCfg = Release|Any CPU + {274786D8-2E30-40D7-81B5-DFA3872CF9B6}.Release|x86.Build.0 = Release|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Debug|x64.ActiveCfg = Debug|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Debug|x64.Build.0 = Debug|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Debug|x86.ActiveCfg = Debug|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Debug|x86.Build.0 = Debug|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Release|Any CPU.Build.0 = Release|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Release|x64.ActiveCfg = Release|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Release|x64.Build.0 = Release|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Release|x86.ActiveCfg = Release|Any CPU + {0F8297F6-FA4F-44B6-BF99-0FF71ECCF87A}.Release|x86.Build.0 = Release|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Debug|x64.ActiveCfg = Debug|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Debug|x64.Build.0 = Debug|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Debug|x86.ActiveCfg = Debug|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Debug|x86.Build.0 = Debug|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Release|Any CPU.Build.0 = Release|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Release|x64.ActiveCfg = Release|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Release|x64.Build.0 = Release|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Release|x86.ActiveCfg = Release|Any CPU + {7A21A074-AEBB-4B33-80BA-D7DFBE87A449}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A3449832-9F8D-413F-8336-8EBEEB77353B} + EndGlobalSection +EndGlobal diff --git a/FacadePattern/App.config b/FacadePattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/FacadePattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/FacadePattern/Dimmer.cs b/FacadePattern/Dimmer.cs index d9cfef3..11c35df 100644 --- a/FacadePattern/Dimmer.cs +++ b/FacadePattern/Dimmer.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FacadePattern { diff --git a/FacadePattern/DvdPlayer.cs b/FacadePattern/DvdPlayer.cs index ffaa58c..f442655 100644 --- a/FacadePattern/DvdPlayer.cs +++ b/FacadePattern/DvdPlayer.cs @@ -12,14 +12,14 @@ public void Insert(Dvd dvd) { _dvd = dvd; Console.WriteLine($"Inserting {dvd.Movie}"); - + } public void Play() => Console.WriteLine($"Playing {_dvd.Movie}"); public void Pause() { - Console.WriteLine($"Pausing at {_time = (new Random()).Next(_time,_time + 120)}"); + Console.WriteLine($"Pausing at {_time = (new Random()).Next(_time, _time + 120)}"); } public void Resume() diff --git a/FacadePattern/FacadePattern.csproj b/FacadePattern/FacadePattern.csproj index ca3bab7..74abf5c 100644 --- a/FacadePattern/FacadePattern.csproj +++ b/FacadePattern/FacadePattern.csproj @@ -1,56 +1,10 @@ - - - + + - Debug - AnyCPU - {C5CB5821-CC3B-4440-9CB9-A571A5D7B872} Exe - FacadePattern - FacadePattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/FacadePattern/HometheaterFacade.cs b/FacadePattern/HometheaterFacade.cs index 2d09049..703828e 100644 --- a/FacadePattern/HometheaterFacade.cs +++ b/FacadePattern/HometheaterFacade.cs @@ -5,8 +5,8 @@ public class HomeTheatreFacade private Dimmer _dimmer; private Dvd _dvd; private DvdPlayer _dvdPlayer; - - public HomeTheatreFacade(Dimmer dimmer,Dvd dvd, DvdPlayer dvdPlayer) + + public HomeTheatreFacade(Dimmer dimmer, Dvd dvd, DvdPlayer dvdPlayer) { _dvd = dvd; _dimmer = dimmer; diff --git a/FacadePattern/Program.cs b/FacadePattern/Program.cs index a695029..074539c 100644 --- a/FacadePattern/Program.cs +++ b/FacadePattern/Program.cs @@ -9,7 +9,7 @@ private static void Main() var dimmer = new Dimmer(); var dvdPlayer = new DvdPlayer(); var dvd = new Dvd("Gone with the Wind 2 : Electric Bugaloo"); - var homeTheater = new HomeTheatreFacade(dimmer,dvd,dvdPlayer); + var homeTheater = new HomeTheatreFacade(dimmer, dvd, dvdPlayer); homeTheater.WatchMovie(); Console.WriteLine(); diff --git a/FacadePattern/Properties/AssemblyInfo.cs b/FacadePattern/Properties/AssemblyInfo.cs deleted file mode 100644 index e778ca3..0000000 --- a/FacadePattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FacadePattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FacadePattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c5cb5821-cc3b-4440-9cb9-a571a5d7b872")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FactoryPattern/Abstract Factory/Ingredients/Intefaces/ICheese.cs b/FactoryPattern/Abstract Factory/Ingredients/Interfaces/ICheese.cs similarity index 100% rename from FactoryPattern/Abstract Factory/Ingredients/Intefaces/ICheese.cs rename to FactoryPattern/Abstract Factory/Ingredients/Interfaces/ICheese.cs diff --git a/FactoryPattern/Abstract Factory/Ingredients/Intefaces/IClam.cs b/FactoryPattern/Abstract Factory/Ingredients/Interfaces/IClam.cs similarity index 100% rename from FactoryPattern/Abstract Factory/Ingredients/Intefaces/IClam.cs rename to FactoryPattern/Abstract Factory/Ingredients/Interfaces/IClam.cs diff --git a/FactoryPattern/Abstract Factory/Ingredients/Intefaces/IDough.cs b/FactoryPattern/Abstract Factory/Ingredients/Interfaces/IDough.cs similarity index 100% rename from FactoryPattern/Abstract Factory/Ingredients/Intefaces/IDough.cs rename to FactoryPattern/Abstract Factory/Ingredients/Interfaces/IDough.cs diff --git a/FactoryPattern/Abstract Factory/Ingredients/Intefaces/ISauce.cs b/FactoryPattern/Abstract Factory/Ingredients/Interfaces/ISauce.cs similarity index 100% rename from FactoryPattern/Abstract Factory/Ingredients/Intefaces/ISauce.cs rename to FactoryPattern/Abstract Factory/Ingredients/Interfaces/ISauce.cs diff --git a/FactoryPattern/Abstract Factory/Ingredients/Intefaces/IVeggies.cs b/FactoryPattern/Abstract Factory/Ingredients/Interfaces/IVeggies.cs similarity index 100% rename from FactoryPattern/Abstract Factory/Ingredients/Intefaces/IVeggies.cs rename to FactoryPattern/Abstract Factory/Ingredients/Interfaces/IVeggies.cs diff --git a/FactoryPattern/App.config b/FactoryPattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/FactoryPattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/FactoryPattern/Factory Method/ChicagoPizzaFactory.cs b/FactoryPattern/Factory Method/ChicagoPizzaFactory.cs index 63df3a3..234bdb0 100644 --- a/FactoryPattern/Factory Method/ChicagoPizzaFactory.cs +++ b/FactoryPattern/Factory Method/ChicagoPizzaFactory.cs @@ -2,25 +2,29 @@ { class ChicagoPizzaFactory : PizzaFactory { - protected override Pizza Create(string type) + private readonly string chicagoCheese = "Chicago Cheese"; + private readonly string chicagoClam = "Chicago Clam"; + private readonly string chicagoVeggie = "Chicago Veggie"; + + protected override Pizza Create(PizzaType type) { Pizza pizza; IIngredientsFactory ingredients = new ChicagoIngredientsFactory(); - - if (type.Equals("Cheese")) + + if (type == PizzaType.Cheese) { pizza = new CheesePizza(ingredients); - pizza.Name = "Chicago Cheese"; + pizza.Name = chicagoCheese; } - else if (type.Equals("Clam")) + else if (type == PizzaType.Clam) { pizza = new ClamPizza(ingredients); - pizza.Name = "Chicago Clam"; + pizza.Name = chicagoClam; } else { pizza = new VeggiePizza(ingredients); - pizza.Name = "Chicago Veggie"; + pizza.Name = chicagoVeggie; } pizza.Color = "red"; return pizza; diff --git a/FactoryPattern/Factory Method/NYPizzaFactory.cs b/FactoryPattern/Factory Method/NYPizzaFactory.cs index d1a2776..de2d0b7 100644 --- a/FactoryPattern/Factory Method/NYPizzaFactory.cs +++ b/FactoryPattern/Factory Method/NYPizzaFactory.cs @@ -2,22 +2,26 @@ { class NyPizzaFactory : PizzaFactory { - protected override Pizza Create(string type) + private readonly string nyStyleCheese = "NY Style Cheese"; + private readonly string nyStyleClam = "NY Style Clam"; + private readonly string nyStyleVeggie = "NY Style Veggie"; + + protected override Pizza Create(PizzaType type) { Pizza pizza; IIngredientsFactory ingredients = new NyIngredientsFactory(); - if (type.Equals("Cheese")) + if (type == PizzaType.Cheese) { - pizza = new CheesePizza(ingredients) {Name = "NY Style Cheese"}; + pizza = new CheesePizza(ingredients) { Name = nyStyleCheese }; } - else if (type.Equals("Clam")) + else if (type == PizzaType.Clam) { - pizza = new ClamPizza(ingredients) {Name = "NY Style Clam"}; + pizza = new ClamPizza(ingredients) { Name = nyStyleClam }; } else { - pizza = new VeggiePizza(ingredients) {Name = "NY Style Veggie"}; + pizza = new VeggiePizza(ingredients) { Name = nyStyleVeggie }; } pizza.Color = "blue"; return pizza; diff --git a/FactoryPattern/Factory Method/PizzaFactory.cs b/FactoryPattern/Factory Method/PizzaFactory.cs index 31ead68..f0b7a38 100644 --- a/FactoryPattern/Factory Method/PizzaFactory.cs +++ b/FactoryPattern/Factory Method/PizzaFactory.cs @@ -2,7 +2,7 @@ { abstract class PizzaFactory { - public Pizza Order(string type) + public Pizza Order(PizzaType type) { var pizza = Create(type); pizza.Prepare(); @@ -12,6 +12,6 @@ public Pizza Order(string type) return pizza; } - protected abstract Pizza Create(string type); + protected abstract Pizza Create(PizzaType type); } } diff --git a/FactoryPattern/FactoryPattern.csproj b/FactoryPattern/FactoryPattern.csproj index 7202cea..74abf5c 100644 --- a/FactoryPattern/FactoryPattern.csproj +++ b/FactoryPattern/FactoryPattern.csproj @@ -1,80 +1,10 @@ - - - + + - Debug - AnyCPU - {D154B3A3-1C97-4B70-AD4F-DC4DB8F52300} Exe - FactoryPattern - FactoryPattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/FactoryPattern/Helper.cs b/FactoryPattern/Helper.cs new file mode 100644 index 0000000..4a897e8 --- /dev/null +++ b/FactoryPattern/Helper.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FactoryPattern +{ + internal class Helper + { + } + + internal enum PizzaType + { + Cheese, + Clam + } +} diff --git a/FactoryPattern/Pizza/CheesePizza.cs b/FactoryPattern/Pizza/CheesePizza.cs index 60dac3c..c7e26b5 100644 --- a/FactoryPattern/Pizza/CheesePizza.cs +++ b/FactoryPattern/Pizza/CheesePizza.cs @@ -12,7 +12,7 @@ public CheesePizza(IIngredientsFactory ing) } internal override void Prepare() { - Console.WriteLine("Preparing " + Name + " Using"); + Console.WriteLine("Preparing " + Name + " Using"); Console.Write("Dough: " + _ingredients.CreateDough().Name + ", Cheese: " + _ingredients.CreateCheese().Name + ", Sauce: " + _ingredients.CreateSauce().Name + ", Veggies: "); Console.WriteLine(); foreach (var val in _ingredients.CreateVeggies()) diff --git a/FactoryPattern/Program.cs b/FactoryPattern/Program.cs index 21a9212..0612463 100644 --- a/FactoryPattern/Program.cs +++ b/FactoryPattern/Program.cs @@ -8,11 +8,11 @@ static void Main() { Console.WriteLine("Yankees fan orders:"); var yankees = new NyPizzaFactory(); - yankees.Order("Cheese"); + yankees.Order(PizzaType.Cheese); Console.WriteLine(); Console.WriteLine("Cubs fan orders:"); var cubs = new ChicagoPizzaFactory(); - cubs.Order("Clam"); + cubs.Order(PizzaType.Clam); } } -} +} \ No newline at end of file diff --git a/FactoryPattern/Properties/AssemblyInfo.cs b/FactoryPattern/Properties/AssemblyInfo.cs deleted file mode 100644 index bf2f310..0000000 --- a/FactoryPattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FactoryPattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FactoryPattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d154b3a3-1c97-4b70-ad4f-dc4db8f52300")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FlyweightPattern/BeverageFlyweightFactory.cs b/FlyweightPattern/BeverageFlyweightFactory.cs new file mode 100644 index 0000000..2863293 --- /dev/null +++ b/FlyweightPattern/BeverageFlyweightFactory.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; + +namespace FlyweightPattern +{ + public class BeverageFlyweightFactory + { + private readonly Dictionary _beverages; + + public BeverageFlyweightFactory() + { + _beverages = new Dictionary(); + } + + public IBeverage MakeBeverage(BeverageType type) + { + _beverages.TryGetValue(type, out var beverage); + if (beverage == null) + { + switch (type) + { + case BeverageType.BubbleMilk: + beverage = new BubbleMilkTea(); + _beverages.Add(BeverageType.BubbleMilk, beverage); + break; + case BeverageType.FoamMilk: + beverage = new FoamMilkTea(); + _beverages.Add(BeverageType.FoamMilk, beverage); + break; + case BeverageType.OolongMilk: + beverage = new OolingMilkTea(); + _beverages.Add(BeverageType.OolongMilk, beverage); + break; + case BeverageType.CoconutMilk: + beverage = new CoconutMilkTea(); + _beverages.Add(BeverageType.CoconutMilk, beverage); + break; + default: + throw new ArgumentOutOfRangeException(nameof(type), type, null); + } + } + + return beverage; + } + } +} \ No newline at end of file diff --git a/FlyweightPattern/BeverageType.cs b/FlyweightPattern/BeverageType.cs new file mode 100644 index 0000000..4d37a0d --- /dev/null +++ b/FlyweightPattern/BeverageType.cs @@ -0,0 +1,7 @@ +namespace FlyweightPattern +{ + public enum BeverageType + { + BubbleMilk, FoamMilk, OolongMilk, CoconutMilk + } +} \ No newline at end of file diff --git a/FlyweightPattern/BubbleMilkTea.cs b/FlyweightPattern/BubbleMilkTea.cs new file mode 100644 index 0000000..c58ab9b --- /dev/null +++ b/FlyweightPattern/BubbleMilkTea.cs @@ -0,0 +1,17 @@ +using System; + +namespace FlyweightPattern +{ + public class BubbleMilkTea : IBeverage + { + public BubbleMilkTea() + { + Console.WriteLine("Initializing a Bubble Milk Tea instance"); + } + + public void Drink() + { + Console.WriteLine("hmmm... this is bubble milk tea"); + } + } +} \ No newline at end of file diff --git a/FlyweightPattern/BubbleTeaShop.cs b/FlyweightPattern/BubbleTeaShop.cs new file mode 100644 index 0000000..e6bcbae --- /dev/null +++ b/FlyweightPattern/BubbleTeaShop.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; + +namespace FlyweightPattern +{ + public class BubbleTeaShop + { + private List takeAwayOrders; + + public BubbleTeaShop() + { + takeAwayOrders = new List(); + TakeOrders(); + } + + private void TakeOrders() + { + var factory = new BeverageFlyweightFactory(); + + takeAwayOrders.Add(factory.MakeBeverage(BeverageType.BubbleMilk)); + takeAwayOrders.Add(factory.MakeBeverage(BeverageType.BubbleMilk)); + takeAwayOrders.Add(factory.MakeBeverage(BeverageType.CoconutMilk)); + takeAwayOrders.Add(factory.MakeBeverage(BeverageType.FoamMilk)); + takeAwayOrders.Add(factory.MakeBeverage(BeverageType.OolongMilk)); + takeAwayOrders.Add(factory.MakeBeverage(BeverageType.OolongMilk)); + } + + public void Enumerate() + { + Console.WriteLine("Enumerating take away orders\n"); + foreach (var beverage in takeAwayOrders) + { + beverage.Drink(); + } + } + } +} \ No newline at end of file diff --git a/FlyweightPattern/CoconutMilkTea.cs b/FlyweightPattern/CoconutMilkTea.cs new file mode 100644 index 0000000..f96035b --- /dev/null +++ b/FlyweightPattern/CoconutMilkTea.cs @@ -0,0 +1,17 @@ +using System; + +namespace FlyweightPattern +{ + public class CoconutMilkTea : IBeverage + { + public CoconutMilkTea() + { + Console.WriteLine("Initializing a Coconut Milk Tea instance"); + } + + public void Drink() + { + Console.WriteLine("hmmm... this is coconut milk tea"); + } + } +} \ No newline at end of file diff --git a/FlyweightPattern/FlyweightPattern.csproj b/FlyweightPattern/FlyweightPattern.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/FlyweightPattern/FlyweightPattern.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/FlyweightPattern/FoamMilkTea.cs b/FlyweightPattern/FoamMilkTea.cs new file mode 100644 index 0000000..958b9d7 --- /dev/null +++ b/FlyweightPattern/FoamMilkTea.cs @@ -0,0 +1,18 @@ +using System; + +namespace FlyweightPattern +{ + public class FoamMilkTea : IBeverage + { + + public FoamMilkTea() + { + Console.WriteLine("Initializing a Foam Milk Tea instance"); + } + + public void Drink() + { + Console.WriteLine("hmmm... this is foam milk tea"); + } + } +} \ No newline at end of file diff --git a/FlyweightPattern/IBeverage.cs b/FlyweightPattern/IBeverage.cs new file mode 100644 index 0000000..0a271d2 --- /dev/null +++ b/FlyweightPattern/IBeverage.cs @@ -0,0 +1,7 @@ +namespace FlyweightPattern +{ + public interface IBeverage + { + void Drink(); + } +} \ No newline at end of file diff --git a/FlyweightPattern/OolingMilkTea.cs b/FlyweightPattern/OolingMilkTea.cs new file mode 100644 index 0000000..40a3715 --- /dev/null +++ b/FlyweightPattern/OolingMilkTea.cs @@ -0,0 +1,18 @@ +using System; + +namespace FlyweightPattern +{ + public class OolingMilkTea : IBeverage + { + + public OolingMilkTea() + { + Console.WriteLine("Initializing an Oolong Milk Tea instance"); + } + + public void Drink() + { + Console.WriteLine("hmmm... this is oolong milk tea"); + } + } +} \ No newline at end of file diff --git a/FlyweightPattern/Program.cs b/FlyweightPattern/Program.cs new file mode 100644 index 0000000..462bab7 --- /dev/null +++ b/FlyweightPattern/Program.cs @@ -0,0 +1,11 @@ +namespace FlyweightPattern +{ + static class Program + { + private static void Main() + { + var teaShop = new BubbleTeaShop(); + teaShop.Enumerate(); + } + } +} \ No newline at end of file diff --git a/IteratorPattern/App.config b/IteratorPattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/IteratorPattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/IteratorPattern/BreakfastMenu.cs b/IteratorPattern/BreakfastMenu.cs index c9ad3d8..f4b5073 100644 --- a/IteratorPattern/BreakfastMenu.cs +++ b/IteratorPattern/BreakfastMenu.cs @@ -20,16 +20,16 @@ public BreakfastMenu() AddItem("Waffle", "Blueberry Sauce topped breakfast Waffles", 125, false); AddItem("Sandwich", "Veggie Sandwich with tomato and cucumber", 75, true); - AddItem("Pankcakes", "Maple syrup Pancakes",110,false); - AddItem("Corn Flakes", "Cornflakes with fruits and nuts",60,true); + AddItem("Pankcakes", "Maple syrup Pancakes", 110, false); + AddItem("Corn Flakes", "Cornflakes with fruits and nuts", 60, true); } private void AddItem(string name, string description, int price, bool veg) { - var item = new Menu(name,description,price,veg); + var item = new Menu(name, description, price, veg); _items.Add(item); } - + } } \ No newline at end of file diff --git a/IteratorPattern/BreakfastMenuEnum.cs b/IteratorPattern/BreakfastMenuEnum.cs index d661b02..683cd3c 100644 --- a/IteratorPattern/BreakfastMenuEnum.cs +++ b/IteratorPattern/BreakfastMenuEnum.cs @@ -37,7 +37,7 @@ public Menu Current { try { - return (Menu) _items[_position]; + return (Menu)_items[_position]; } catch (IndexOutOfRangeException) { diff --git a/IteratorPattern/BreakfastMenuIterator.cs b/IteratorPattern/BreakfastMenuIterator.cs index 9c25928..68bd86e 100644 --- a/IteratorPattern/BreakfastMenuIterator.cs +++ b/IteratorPattern/BreakfastMenuIterator.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Generic; +using System.Collections; namespace IteratorPattern { diff --git a/IteratorPattern/Client.cs b/IteratorPattern/Client.cs index 21f2db8..27a1a5b 100644 --- a/IteratorPattern/Client.cs +++ b/IteratorPattern/Client.cs @@ -26,7 +26,7 @@ private void PrintMenu(IEnumerable iter) { foreach (var item in iter) { - var i = (Menu) item; + var i = (Menu)item; Console.WriteLine($"{i.Name} Rs. {i.Price} { (i.Vegetarian ? "*" : "x") } \n {i.Description} "); } diff --git a/IteratorPattern/DinnerMenu.cs b/IteratorPattern/DinnerMenu.cs index cd0c7a6..877fcc7 100644 --- a/IteratorPattern/DinnerMenu.cs +++ b/IteratorPattern/DinnerMenu.cs @@ -28,7 +28,7 @@ public DinnerMenu() private void AddItems(string name, string description, int price, bool veg) { - var item = new Menu(name,description,price,veg); + var item = new Menu(name, description, price, veg); if (_count <= Max) { diff --git a/IteratorPattern/DinnerMenuEnum.cs b/IteratorPattern/DinnerMenuEnum.cs index a567833..68929eb 100644 --- a/IteratorPattern/DinnerMenuEnum.cs +++ b/IteratorPattern/DinnerMenuEnum.cs @@ -1,6 +1,5 @@ using System; using System.Collections; -using System.Collections.Generic; namespace IteratorPattern { diff --git a/IteratorPattern/DinnerMenuIterator.cs b/IteratorPattern/DinnerMenuIterator.cs index a5fd659..c4dca48 100644 --- a/IteratorPattern/DinnerMenuIterator.cs +++ b/IteratorPattern/DinnerMenuIterator.cs @@ -1,5 +1,4 @@ using System.Collections; -using System.Collections.Generic; namespace IteratorPattern { diff --git a/IteratorPattern/IteratorPattern.csproj b/IteratorPattern/IteratorPattern.csproj index 005791c..74abf5c 100644 --- a/IteratorPattern/IteratorPattern.csproj +++ b/IteratorPattern/IteratorPattern.csproj @@ -1,60 +1,10 @@ - - - + + - Debug - AnyCPU - {A3B8C12F-5DAC-4CEA-B039-C2CBD7A5C9AD} Exe - IteratorPattern - IteratorPattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/IteratorPattern/Menu.cs b/IteratorPattern/Menu.cs index 355ed4d..984f85f 100644 --- a/IteratorPattern/Menu.cs +++ b/IteratorPattern/Menu.cs @@ -14,6 +14,6 @@ public Menu(string name, string description, double price, bool vegetarian) Price = price; Vegetarian = vegetarian; } - + } } \ No newline at end of file diff --git a/IteratorPattern/Program.cs b/IteratorPattern/Program.cs index 6f5712d..dae6a70 100644 --- a/IteratorPattern/Program.cs +++ b/IteratorPattern/Program.cs @@ -6,8 +6,8 @@ private static void Main() { var breakfast = new BreakfastMenu(); var dinner = new DinnerMenu(); - var waiter = new Client(breakfast,dinner); + var waiter = new Client(breakfast, dinner); waiter.PrintMenu(); } - } + } } diff --git a/IteratorPattern/Properties/AssemblyInfo.cs b/IteratorPattern/Properties/AssemblyInfo.cs deleted file mode 100644 index 62fb325..0000000 --- a/IteratorPattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("IteratorPattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("IteratorPattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a3b8c12f-5dac-4cea-b039-c2cbd7a5c9ad")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MediatorPattern/Colleague.cs b/MediatorPattern/Colleague.cs new file mode 100644 index 0000000..78c694a --- /dev/null +++ b/MediatorPattern/Colleague.cs @@ -0,0 +1,14 @@ +namespace MediatorPattern +{ + abstract class Colleague + { + protected Mediator mediator; + + public Colleague(Mediator mediator) => this.mediator = mediator; + + public virtual void Send(string message) => this.mediator.Send(message, this); + + public abstract void Notify(string message); + + } +} \ No newline at end of file diff --git a/MediatorPattern/Customer.cs b/MediatorPattern/Customer.cs new file mode 100644 index 0000000..b3bf289 --- /dev/null +++ b/MediatorPattern/Customer.cs @@ -0,0 +1,14 @@ +using System; + +namespace MediatorPattern +{ + class Customer : Colleague + { + public Customer(Mediator mediator) : base(mediator) { } + + public override void Notify(string message) + { + Console.WriteLine($"Message to customer: {message}"); + } + } +} \ No newline at end of file diff --git a/MediatorPattern/ManagerMediator.cs b/MediatorPattern/ManagerMediator.cs new file mode 100644 index 0000000..ceda018 --- /dev/null +++ b/MediatorPattern/ManagerMediator.cs @@ -0,0 +1,22 @@ +namespace MediatorPattern +{ + class ManagerMediator : Mediator + { + public Colleague Customer { get; set; } + public Colleague Programmer { get; set; } + public Colleague Tester { get; set; } + + public override void Send(string message, Colleague colleague) + { + if (colleague == Customer) + { + Programmer.Notify(message); + } + else if (colleague == Programmer) + { + Tester.Notify(message); + } + else Customer.Notify(message); + } + } +} \ No newline at end of file diff --git a/MediatorPattern/Mediator.cs b/MediatorPattern/Mediator.cs new file mode 100644 index 0000000..2646a13 --- /dev/null +++ b/MediatorPattern/Mediator.cs @@ -0,0 +1,7 @@ +namespace MediatorPattern +{ + abstract class Mediator + { + public abstract void Send(string message, Colleague colleague); + } +} \ No newline at end of file diff --git a/MediatorPattern/MediatorPattern.csproj b/MediatorPattern/MediatorPattern.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/MediatorPattern/MediatorPattern.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/MediatorPattern/Program.cs b/MediatorPattern/Program.cs new file mode 100644 index 0000000..bbdddc5 --- /dev/null +++ b/MediatorPattern/Program.cs @@ -0,0 +1,19 @@ +namespace MediatorPattern +{ + class Program + { + static void Main(string[] args) + { + var mediator = new ManagerMediator(); + var customer = new Customer(mediator); + var programmer = new Programmer(mediator); + var tester = new Tester(mediator); + mediator.Customer = customer; + mediator.Programmer = programmer; + mediator.Tester = tester; + customer.Send("We have an order, need to make a program"); + programmer.Send("I have done program, need to test it"); + tester.Send("I have done testing, here is ready program for you"); + } + } +} \ No newline at end of file diff --git a/MediatorPattern/Programmer.cs b/MediatorPattern/Programmer.cs new file mode 100644 index 0000000..cef0b16 --- /dev/null +++ b/MediatorPattern/Programmer.cs @@ -0,0 +1,14 @@ +using System; + +namespace MediatorPattern +{ + class Programmer : Colleague + { + public Programmer(Mediator mediator) : base(mediator) { } + + public override void Notify(string message) + { + Console.WriteLine($"Message to programmer: {message}"); + } + } +} \ No newline at end of file diff --git a/MediatorPattern/Tester.cs b/MediatorPattern/Tester.cs new file mode 100644 index 0000000..0fe71d7 --- /dev/null +++ b/MediatorPattern/Tester.cs @@ -0,0 +1,14 @@ +using System; + +namespace MediatorPattern +{ + class Tester : Colleague + { + public Tester(Mediator mediator) : base(mediator) { } + + public override void Notify(string message) + { + Console.WriteLine($"Message to tester: {message}"); + } + } +} \ No newline at end of file diff --git a/ObserverPattern/App.config b/ObserverPattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/ObserverPattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ObserverPattern/ObserverPattern.csproj b/ObserverPattern/ObserverPattern.csproj index 28f78db..74abf5c 100644 --- a/ObserverPattern/ObserverPattern.csproj +++ b/ObserverPattern/ObserverPattern.csproj @@ -1,56 +1,10 @@ - - - + + - Debug - AnyCPU - {678581C4-15DC-4A01-93CD-76ACBD5B7462} Exe - ObserverPattern - ObserverPattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/ObserverPattern/Properties/AssemblyInfo.cs b/ObserverPattern/Properties/AssemblyInfo.cs deleted file mode 100644 index 471caec..0000000 --- a/ObserverPattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ObserverPattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ObserverPattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("678581c4-15dc-4a01-93cd-76acbd5b7462")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ObserverPattern/WeatherMonitor.cs b/ObserverPattern/WeatherMonitor.cs index 5cf8942..6d65f37 100644 --- a/ObserverPattern/WeatherMonitor.cs +++ b/ObserverPattern/WeatherMonitor.cs @@ -21,7 +21,7 @@ public WeatherMonitor(string name) { _name = name; } - + public void OnCompleted() { throw new NotImplementedException(); @@ -39,7 +39,7 @@ public void OnNext(Weather value) { string op = $"| Temperature : {value.Temperature} Celsius |"; Console.Write(op); - + } if (_name.Contains("P")) { @@ -48,7 +48,7 @@ public void OnNext(Weather value) } if (_name.Contains("H")) { - string op = $"| Humidity : {value.Humidity*100} % |"; + string op = $"| Humidity : {value.Humidity * 100} % |"; Console.Write(op); } if (!(_name.Contains("T") || _name.Contains("P") || _name.Contains("H"))) diff --git a/PrototypePattern/Circle.cs b/PrototypePattern/Circle.cs new file mode 100644 index 0000000..6289f77 --- /dev/null +++ b/PrototypePattern/Circle.cs @@ -0,0 +1,22 @@ +using System; + +namespace PrototypePattern +{ + class Circle : IFigure + { + readonly int _radius; + public Circle(int r) + { + _radius = r; + } + + public object Clone() + { + return new Circle(_radius); + } + public void GetInfo() + { + Console.WriteLine($"Circle with radius {_radius}"); + } + } +} \ No newline at end of file diff --git a/PrototypePattern/IFigure.cs b/PrototypePattern/IFigure.cs new file mode 100644 index 0000000..85879a4 --- /dev/null +++ b/PrototypePattern/IFigure.cs @@ -0,0 +1,9 @@ +using System; + +namespace PrototypePattern +{ + interface IFigure : ICloneable + { + void GetInfo(); + } +} \ No newline at end of file diff --git a/PrototypePattern/Program.cs b/PrototypePattern/Program.cs new file mode 100644 index 0000000..ebdecdb --- /dev/null +++ b/PrototypePattern/Program.cs @@ -0,0 +1,22 @@ +using System; + +namespace PrototypePattern +{ + class Program + { + static void Main(string[] args) + { + IFigure figure = new Rectangle(30, 40); + IFigure clonedFigure = (IFigure)figure.Clone(); + figure.GetInfo(); + clonedFigure.GetInfo(); + + figure = new Circle(30); + clonedFigure = (IFigure)figure.Clone(); + figure.GetInfo(); + clonedFigure.GetInfo(); + + Console.Read(); + } + } +} diff --git a/PrototypePattern/PrototypePattern.csproj b/PrototypePattern/PrototypePattern.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/PrototypePattern/PrototypePattern.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/PrototypePattern/Rectangle.cs b/PrototypePattern/Rectangle.cs new file mode 100644 index 0000000..9856cf2 --- /dev/null +++ b/PrototypePattern/Rectangle.cs @@ -0,0 +1,24 @@ +using System; + +namespace PrototypePattern +{ + class Rectangle : IFigure + { + readonly int _width; + readonly int _height; + public Rectangle(int w, int h) + { + _width = w; + _height = h; + } + + public object Clone() + { + return new Rectangle(_width, _height); + } + public void GetInfo() + { + Console.WriteLine($"Rectangle height {_height} and width {_width}"); + } + } +} \ No newline at end of file diff --git a/ProxyPattern/Image.cs b/ProxyPattern/Image.cs new file mode 100644 index 0000000..5041b84 --- /dev/null +++ b/ProxyPattern/Image.cs @@ -0,0 +1,8 @@ +namespace ProxyPattern +{ + public interface Image + { + void display(); + + } +} diff --git a/ProxyPattern/Program.cs b/ProxyPattern/Program.cs new file mode 100644 index 0000000..b0cedf6 --- /dev/null +++ b/ProxyPattern/Program.cs @@ -0,0 +1,19 @@ +using System; + +namespace ProxyPattern +{ + class Program + { + static void Main(string[] args) + { + Image image = new ProxyImage("testImage.jpg"); + + //image will be loaded from disk + image.display(); + Console.WriteLine(""); + + //image will not be loaded from disk + image.display(); + } + } +} diff --git a/ProxyPattern/ProxyImage.cs b/ProxyPattern/ProxyImage.cs new file mode 100644 index 0000000..bdab6de --- /dev/null +++ b/ProxyPattern/ProxyImage.cs @@ -0,0 +1,23 @@ +namespace ProxyPattern +{ + public class ProxyImage : Image + { + private RealImage _realImage; + private string _fileName; + + public ProxyImage(string fileName) + { + _fileName = fileName; + } + + + public void display() + { + if (_realImage == null) + { + _realImage = new RealImage(_fileName); + } + _realImage.display(); + } + } +} \ No newline at end of file diff --git a/ProxyPattern/ProxyPattern.csproj b/ProxyPattern/ProxyPattern.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/ProxyPattern/ProxyPattern.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/ProxyPattern/RealImage.cs b/ProxyPattern/RealImage.cs new file mode 100644 index 0000000..d0826fd --- /dev/null +++ b/ProxyPattern/RealImage.cs @@ -0,0 +1,27 @@ +using System; + +namespace ProxyPattern +{ + + public class RealImage : Image + { + + private string _fileName; + + public RealImage(string fileName) + { + _fileName = fileName; + loadFromDisk(_fileName); + } + + public void display() + { + Console.WriteLine("Displaying " + _fileName); + } + + private void loadFromDisk(string fileName) + { + Console.WriteLine("Loading " + fileName); + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index 226b076..f82eb91 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ -# DesignPatterns -Design patterns are solutions to recurring problems; guidelines on how to tackle certain problems +# Design Patterns +Design patterns are solutions to recurring problems; guidelines on how to tackle certain problems. I have included implementations of some design patterns in C# to help beginners like me get their feet wet. -There are better alternatives available for some of them in the .NET Framework, so this is by no means a comprehensive tutorial +There are better alternatives available for some of them in the .NET Framework, so this is by no means a comprehensive tutorial. -Any comments and suggestions are welcome. If you want to add a new design pattern implementation, just follow the naming conversation, fork my repo and submit a pull request. Same goes for any improvements and modifications. +Any comments and suggestions are welcome. If you want to add a new design pattern implementation, just follow the naming convention, fork my repo and submit a pull request. Same goes for any improvements and modifications. + +This was created as a C# alternative to Java while reading https://www.oreilly.com/library/view/head-first-design/0596007124/ <- take a look at it if anything confuses you. ## Types of Design Patterns --------------------------- -There are three kinds of Design Patterns +There are three kinds of Design Patterns: * Creational * Structural @@ -17,14 +19,23 @@ There are three kinds of Design Patterns ----------------------------------------- * [Adapter](/AdapterPattern) +* [Bridge](/BridgePattern) +* [Builder](/BuilderPattern) +* [ChainOfResponsibility](/ChainOfResponsibilityPattern) * [Command](/CommandPattern) * [Composite](/CompositePattern) * [Decorator](/DecoratorPattern) * [Facade](/FacadePattern) * [Factory](/FactoryPattern) +* [Flyweight](/FlyweightPattern) * [Iterator](/IteratorPattern) +* [Mediator](/MediatorPattern) * [Observer](/ObserverPattern) +* [Prototype](/PrototypePattern) +* [Proxy](/ProxyPattern) * [Singleton](/SingletonPattern) +* [SingletonPattern.Tests](/SingletonPattern.Tests) * [State](/StatePattern) * [Strategy](/StrategyPattern) * [Template](/TemplatePattern) +* [Visitor](/VisitorPattern) diff --git a/SingletonPattern.Tests/SingletonPattern.Tests.csproj b/SingletonPattern.Tests/SingletonPattern.Tests.csproj new file mode 100644 index 0000000..ec8a874 --- /dev/null +++ b/SingletonPattern.Tests/SingletonPattern.Tests.csproj @@ -0,0 +1,23 @@ + + + + net6.0 + enable + enable + + false + + + + + + + + + + + + + + + diff --git a/SingletonPattern.Tests/SingletonPatternTests.cs b/SingletonPattern.Tests/SingletonPatternTests.cs new file mode 100644 index 0000000..f015dfc --- /dev/null +++ b/SingletonPattern.Tests/SingletonPatternTests.cs @@ -0,0 +1,17 @@ +namespace SingletonPattern.Tests +{ + [TestFixture] + public class SingletonPatternTests + { + [Test] + public void GetInstance_CreateInstanceTwice_AreEqual() + { + // Arrange, Act + var firstAttemptInstance = ChocolateBoiler.GetInstance(); + var secondAttemptInstance = ChocolateBoiler.GetInstance(); + + // Assert + Assert.That(firstAttemptInstance, Is.EqualTo(secondAttemptInstance)); + } + } +} diff --git a/SingletonPattern.Tests/Usings.cs b/SingletonPattern.Tests/Usings.cs new file mode 100644 index 0000000..3244567 --- /dev/null +++ b/SingletonPattern.Tests/Usings.cs @@ -0,0 +1 @@ +global using NUnit.Framework; diff --git a/SingletonPattern/App.config b/SingletonPattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/SingletonPattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/SingletonPattern/ChocolateBoiler.cs b/SingletonPattern/ChocolateBoiler.cs index 35d3e15..bdc6a2d 100644 --- a/SingletonPattern/ChocolateBoiler.cs +++ b/SingletonPattern/ChocolateBoiler.cs @@ -5,9 +5,9 @@ namespace SingletonPattern internal partial class ChocolateBoiler { private static readonly Lazy _singleton = new Lazy(() => new ChocolateBoiler()); - + public static ChocolateBoiler GetInstance() => _singleton.Value; - + private Status _boiler; private ChocolateBoiler() diff --git a/SingletonPattern/Program.cs b/SingletonPattern/Program.cs index 0609ca0..7d81245 100644 --- a/SingletonPattern/Program.cs +++ b/SingletonPattern/Program.cs @@ -11,7 +11,7 @@ static void Main() var chocoEggs = ChocolateBoiler.GetInstance(); chocoEggs.Fill(); chocoEggs.Boil(); - chocoEggs.Drain(); + chocoEggs.Drain(); } catch (Exception) { diff --git a/SingletonPattern/Properties/AssemblyInfo.cs b/SingletonPattern/Properties/AssemblyInfo.cs index 4837f8d..f6a8309 100644 --- a/SingletonPattern/Properties/AssemblyInfo.cs +++ b/SingletonPattern/Properties/AssemblyInfo.cs @@ -1,35 +1,3 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SingletonPattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SingletonPattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("df749ac5-3277-45b6-b39e-61e7d842b1ba")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly:InternalsVisibleTo("SingletonPattern.Tests")] diff --git a/SingletonPattern/SingletonPattern.csproj b/SingletonPattern/SingletonPattern.csproj index 45bafb2..74abf5c 100644 --- a/SingletonPattern/SingletonPattern.csproj +++ b/SingletonPattern/SingletonPattern.csproj @@ -1,54 +1,10 @@ - - - + + - Debug - AnyCPU - {DF749AC5-3277-45B6-B39E-61E7D842B1BA} Exe - SingletonPattern - SingletonPattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/StatePattern/App.config b/StatePattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/StatePattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/StatePattern/HasQuarterState.cs b/StatePattern/HasQuarterState.cs index f5e4d98..2dc106d 100644 --- a/StatePattern/HasQuarterState.cs +++ b/StatePattern/HasQuarterState.cs @@ -33,7 +33,7 @@ public void TurnCrank() { Machine.State = Machine.SoldState; } - } + } public void Dispense() { diff --git a/StatePattern/NoQuarterState.cs b/StatePattern/NoQuarterState.cs index 5f2d670..978114d 100644 --- a/StatePattern/NoQuarterState.cs +++ b/StatePattern/NoQuarterState.cs @@ -23,7 +23,7 @@ public void EjectQuarter() public void TurnCrank() { - Console.WriteLine("Can't turn crank without a quarter"); + Console.WriteLine("Can't turn crank without a quarter"); } public void Dispense() diff --git a/StatePattern/Properties/AssemblyInfo.cs b/StatePattern/Properties/AssemblyInfo.cs deleted file mode 100644 index 9069228..0000000 --- a/StatePattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("StatePattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("StatePattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("974fe8e8-7379-4dcc-9d4f-763d60f5e708")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/StatePattern/SoldState.cs b/StatePattern/SoldState.cs index 0c2d4f4..e8ecb33 100644 --- a/StatePattern/SoldState.cs +++ b/StatePattern/SoldState.cs @@ -18,7 +18,7 @@ public void InsertQuarter() public void EjectQuarter() { - Console.WriteLine("Can't eject, already turned the crank"); + Console.WriteLine("Can't eject, already turned the crank"); } public void TurnCrank() diff --git a/StatePattern/StatePattern.csproj b/StatePattern/StatePattern.csproj index c10b7b7..74abf5c 100644 --- a/StatePattern/StatePattern.csproj +++ b/StatePattern/StatePattern.csproj @@ -1,61 +1,10 @@ - - - + + - Debug - AnyCPU - {974FE8E8-7379-4DCC-9D4F-763D60F5E708} Exe - StatePattern - StatePattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/StrategyPattern/App.config b/StrategyPattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/StrategyPattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/StrategyPattern/Program.cs b/StrategyPattern/Program.cs index 85f9495..934724b 100644 --- a/StrategyPattern/Program.cs +++ b/StrategyPattern/Program.cs @@ -6,7 +6,8 @@ internal class Duck private IFlyBehaviour _flyer; - public IQuackBehaviour Quacker { + public IQuackBehaviour Quacker + { set { _quacker = value; @@ -52,7 +53,7 @@ internal static class Program { private static void Main() { - var mallard = new MallardDuck {Quacker = new QuackNormal()}; + var mallard = new MallardDuck { Quacker = new QuackNormal() }; mallard.Display(); mallard.Flyer = new FlyWings(); mallard.Display(); diff --git a/StrategyPattern/Properties/AssemblyInfo.cs b/StrategyPattern/Properties/AssemblyInfo.cs deleted file mode 100644 index 89145b8..0000000 --- a/StrategyPattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Ducks")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Ducks")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1f52949e-3569-44ec-8c1c-870d5b263694")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/StrategyPattern/QuackNormal.cs b/StrategyPattern/QuackNormal.cs index aaa0b1f..0dc0053 100644 --- a/StrategyPattern/QuackNormal.cs +++ b/StrategyPattern/QuackNormal.cs @@ -7,6 +7,6 @@ class QuackNormal : IQuackBehaviour public void Quack() { Console.WriteLine("Quack Quack"); - } + } } } diff --git a/StrategyPattern/StrategyPattern.csproj b/StrategyPattern/StrategyPattern.csproj index a9bd777..74abf5c 100644 --- a/StrategyPattern/StrategyPattern.csproj +++ b/StrategyPattern/StrategyPattern.csproj @@ -1,59 +1,10 @@ - - - + + - Debug - AnyCPU - {1F52949E-3569-44EC-8C1C-870D5B263694} Exe - StrategyPattern - StrategyPattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/TemplatePattern/App.config b/TemplatePattern/App.config deleted file mode 100644 index 88fa402..0000000 --- a/TemplatePattern/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/TemplatePattern/Program.cs b/TemplatePattern/Program.cs index cc0c9b3..eb0abae 100644 --- a/TemplatePattern/Program.cs +++ b/TemplatePattern/Program.cs @@ -13,7 +13,7 @@ static void Main() tea.WantsCondiments = true; tea.AddSugar = 5; tea.Prepare(); - + Console.WriteLine(); coffee.WantsCondiments = true; coffee.Prepare(); diff --git a/TemplatePattern/Properties/AssemblyInfo.cs b/TemplatePattern/Properties/AssemblyInfo.cs deleted file mode 100644 index 82372c0..0000000 --- a/TemplatePattern/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TemplatePattern")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TemplatePattern")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("fce8a301-ee20-42db-82dd-47ab0b569bc9")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TemplatePattern/TemplatePattern.csproj b/TemplatePattern/TemplatePattern.csproj index 886b83e..74abf5c 100644 --- a/TemplatePattern/TemplatePattern.csproj +++ b/TemplatePattern/TemplatePattern.csproj @@ -1,56 +1,10 @@ - - - + + - Debug - AnyCPU - {FCE8A301-EE20-42DB-82DD-47AB0B569BC9} Exe - TemplatePattern - TemplatePattern - v4.5.2 - 512 - true + net6.0 + enable + enable - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/VisitorPattern/Apartment.cs b/VisitorPattern/Apartment.cs new file mode 100644 index 0000000..63469c7 --- /dev/null +++ b/VisitorPattern/Apartment.cs @@ -0,0 +1,20 @@ +namespace VisitorPattern +{ + public class Apartment : Unit + { + public Apartment(params Unit[] units) : base(units) + { + } + + public override void Accept(IUnitVisitor visitor) + { + visitor.VisitApartment(this); + base.Accept(visitor); + } + + public override string ToString() + { + return "Apartment"; + } + } +} \ No newline at end of file diff --git a/VisitorPattern/ApartmentVisitor.cs b/VisitorPattern/ApartmentVisitor.cs new file mode 100644 index 0000000..bdc6b81 --- /dev/null +++ b/VisitorPattern/ApartmentVisitor.cs @@ -0,0 +1,24 @@ +using System; + +namespace VisitorPattern +{ + public class ApartmentVisitor : IUnitVisitor + { + public void VisitApartment(Apartment apartment) + { + Console.WriteLine("This is an apartment"); + } + + public void VisitStudio(Studio studio) + { + } + + public void VisitBedroom(Bedroom bedroom) + { + } + + public void VisitLivingRoom(LivingRoom livingRoom) + { + } + } +} \ No newline at end of file diff --git a/VisitorPattern/Bedroom.cs b/VisitorPattern/Bedroom.cs new file mode 100644 index 0000000..ee0d08e --- /dev/null +++ b/VisitorPattern/Bedroom.cs @@ -0,0 +1,20 @@ +namespace VisitorPattern +{ + public class Bedroom : Unit + { + public Bedroom(params Unit[] units) : base(units) + { + } + + public override void Accept(IUnitVisitor visitor) + { + visitor.VisitBedroom(this); + base.Accept(visitor); + } + + public override string ToString() + { + return "Bedroom"; + } + } +} \ No newline at end of file diff --git a/VisitorPattern/BedroomVisitor.cs b/VisitorPattern/BedroomVisitor.cs new file mode 100644 index 0000000..f4792ea --- /dev/null +++ b/VisitorPattern/BedroomVisitor.cs @@ -0,0 +1,24 @@ +using System; + +namespace VisitorPattern +{ + public class BedroomVisitor : IUnitVisitor + { + public void VisitApartment(Apartment apartment) + { + } + + public void VisitStudio(Studio studio) + { + } + + public void VisitBedroom(Bedroom bedroom) + { + Console.WriteLine("Here is a bedroom"); + } + + public void VisitLivingRoom(LivingRoom livingRoom) + { + } + } +} \ No newline at end of file diff --git a/VisitorPattern/IUnitVisitor.cs b/VisitorPattern/IUnitVisitor.cs new file mode 100644 index 0000000..cae7d6c --- /dev/null +++ b/VisitorPattern/IUnitVisitor.cs @@ -0,0 +1,10 @@ +namespace VisitorPattern +{ + public interface IUnitVisitor + { + void VisitApartment(Apartment apartment); + void VisitStudio(Studio studio); + void VisitBedroom(Bedroom bedroom); + void VisitLivingRoom(LivingRoom livingRoom); + } +} \ No newline at end of file diff --git a/VisitorPattern/LivingRoom.cs b/VisitorPattern/LivingRoom.cs new file mode 100644 index 0000000..31e7421 --- /dev/null +++ b/VisitorPattern/LivingRoom.cs @@ -0,0 +1,20 @@ +namespace VisitorPattern +{ + public class LivingRoom : Unit + { + public LivingRoom(params Unit[] units) : base(units) + { + } + + public override void Accept(IUnitVisitor visitor) + { + visitor.VisitLivingRoom(this); + base.Accept(visitor); + } + + public override string ToString() + { + return "Living Room"; + } + } +} \ No newline at end of file diff --git a/VisitorPattern/LivingRoomVisitor.cs b/VisitorPattern/LivingRoomVisitor.cs new file mode 100644 index 0000000..f6cf11a --- /dev/null +++ b/VisitorPattern/LivingRoomVisitor.cs @@ -0,0 +1,24 @@ +using System; + +namespace VisitorPattern +{ + public class LivingRoomVisitor : IUnitVisitor + { + public void VisitApartment(Apartment apartment) + { + } + + public void VisitStudio(Studio studio) + { + } + + public void VisitBedroom(Bedroom bedroom) + { + } + + public void VisitLivingRoom(LivingRoom livingRoom) + { + Console.WriteLine("This is the living room"); + } + } +} \ No newline at end of file diff --git a/VisitorPattern/Program.cs b/VisitorPattern/Program.cs new file mode 100644 index 0000000..3d17f4d --- /dev/null +++ b/VisitorPattern/Program.cs @@ -0,0 +1,22 @@ +using System; + +namespace VisitorPattern +{ + class Program + { + static void Main() + { + var apartment = new Apartment(new LivingRoom(), new Bedroom(), new Bedroom()); + var studio = new Studio(new LivingRoom(), new Bedroom()); + Console.WriteLine("Visiting an Apartment"); + apartment.Accept(new ApartmentVisitor()); + apartment.Accept(new LivingRoomVisitor()); + apartment.Accept(new BedroomVisitor()); + + Console.WriteLine("Visiting a Studio"); + studio.Accept(new StudioVisitor()); + studio.Accept(new LivingRoomVisitor()); + studio.Accept(new BedroomVisitor()); + } + } +} \ No newline at end of file diff --git a/VisitorPattern/Studio.cs b/VisitorPattern/Studio.cs new file mode 100644 index 0000000..aa48f4e --- /dev/null +++ b/VisitorPattern/Studio.cs @@ -0,0 +1,20 @@ +namespace VisitorPattern +{ + public class Studio : Unit + { + public Studio(params Unit[] units) : base(units) + { + } + + public override void Accept(IUnitVisitor visitor) + { + visitor.VisitStudio(this); + base.Accept(visitor); + } + + public override string ToString() + { + return "Studio"; + } + } +} \ No newline at end of file diff --git a/VisitorPattern/StudioVisitor.cs b/VisitorPattern/StudioVisitor.cs new file mode 100644 index 0000000..82c2521 --- /dev/null +++ b/VisitorPattern/StudioVisitor.cs @@ -0,0 +1,24 @@ +using System; + +namespace VisitorPattern +{ + public class StudioVisitor : IUnitVisitor + { + public void VisitApartment(Apartment apartment) + { + } + + public void VisitStudio(Studio studio) + { + Console.WriteLine("This is a studio"); + } + + public void VisitBedroom(Bedroom bedroom) + { + } + + public void VisitLivingRoom(LivingRoom livingRoom) + { + } + } +} \ No newline at end of file diff --git a/VisitorPattern/Unit.cs b/VisitorPattern/Unit.cs new file mode 100644 index 0000000..13f1b69 --- /dev/null +++ b/VisitorPattern/Unit.cs @@ -0,0 +1,22 @@ +namespace VisitorPattern +{ + public abstract class Unit + { + private Unit[] _units; + + public Unit(params Unit[] units) + { + _units = units; + } + + public virtual void Accept(IUnitVisitor visitor) + { + foreach (var unit in _units) + { + unit.Accept(visitor); + } + } + + public abstract string ToString(); + } +} \ No newline at end of file diff --git a/VisitorPattern/VisitorPattern.csproj b/VisitorPattern/VisitorPattern.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/VisitorPattern/VisitorPattern.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + +