The decorator design pattern is a structural pattern that is used to add new functionality to an existing object without changing its structure. The original class is wrapped in decorator class wraps and new behaviors and operations are added to an object at runtime:
The Component interface and the members it contains are implemented by the ConcreteComponent class and the Decorator class. ConcreteComponent implements the Component interface. The Decorator class is an abstract class that implements the Component interface and contains the reference to a Component instance. The Decorator class is the base class for components. The ConcreteDecorator class inherits from the Decorator class and provides a decorator for components.
We are going to write an example that wraps an operation in a try/catch block. Both try and catch will output a string to the console. Create a new .NET 4.8 console application named CH10_AddressingCrossCuttingConcerns...