关于[Design patterns in C# - The Decorator Pattern]的摘要:
So, after a long break, this week I've decided to revive my series on design patterns in C#, and move on to the decorator pattern! To use the decorator pattern, you wrap an object in another object in order to extend behaviour. The objects all implement the same interface, so the decorators can stack on top of one another, extendng the behaviour further. Using this pattern, you are able to extend the behaviour of a single object, rather than extending the behaviour of a class as a whole (by e.g. using subclasses).
原文地址: https://endjin.com/blog/2020/10/design-patterns-in-csharp-the-decorator-pattern