private static void SmallWidget() { AbstractWidget widget = new SmallWidget(); WagBuilder builder = new WidgetBuilder(widget); WagDirector director = new WidgetDirector(); IWag smallWidget = director.Build(builder); Console.WriteLine(smallWidget); }
private static void DecoratorPatternDemo() { IWag mySmallWidget = new SmallWidget(FinishColor.PlainBlack); Console.WriteLine(mySmallWidget); mySmallWidget = new CustomComponentsOption(mySmallWidget); Console.WriteLine(mySmallWidget); mySmallWidget = new EverythingGoldOption(mySmallWidget); Console.WriteLine(mySmallWidget); }
private static void BuilderPatternDemo() { AbstractWidget abstractWidget = new SmallWidget(FinishColor.PlatedPlatinum); WagBuilder wagBuilder = new WidgetBuilder(abstractWidget); WagDirector wagDirector = new WidgetDirector(); IWag widget = wagDirector.Build(wagBuilder); Console.WriteLine(widget); AbstractGadget abstractGadget = new SmallGadget(FinishColor.PlainBlack); WagBuilder builder = new GadgetBuilder(abstractGadget); WagDirector director = new GadgetDirector(); IWag gadget = director.Build(builder); Console.WriteLine(gadget); }