classProgram { staticvoidMain(string[] args) { Client client = new Client();
var simple = new ConcreteComponent(); Console.WriteLine("Client: I get a simple component:"); client.ClientCode(simple); Console.WriteLine();
ConcreteDecoratorA decorator1 = new ConcreteDecoratorA(simple); ConcreteDecoratorB decorator2 = new ConcreteDecoratorB(decorator1); Console.WriteLine("Client: Now I've got a decorated component:"); client.ClientCode(decorator2); // output
// Client: I get a simple component: // RESULT: ConcreteComponent
// Client: Now I've got a decorated component: // RESULT: ConcreteDecoratorB(ConcreteDecoratorA(ConcreteComponent)) } } }