/// <summary> /// Entry point into console application. /// </summary> static void Main() { // Create ConcreteComponent and two Decorators ConcreteComponent c = new ConcreteComponent(); ConcreteDecoratorA d1 = new ConcreteDecoratorA(); ConcreteDecoratorB d2 = new ConcreteDecoratorB(); // Link decorators d1.SetComponent(c); d2.SetComponent(d1); d2.Operation(); // Wait for user Console.ReadKey(); }
static void Main(string[] args) { ConcreteComponent c = new ConcreteComponent(); ConcreteDectoratorA d1 = new ConcreteDectoratorA(); ConcreteDectoratorB d2 = new ConcreteDectoratorB(); d1.SetComponent(c); d2.SetComponent(d1); d2.Operation(); Console.ReadKey(); }