Skip to content

RE: Dynamic Behavior with the Decorator Pattern

Here’s great example of how to use the Decorator pattern in C#….

The Decorator pattern is a means to transparently add responsibilities to another object on the fly.  In some cases it’s a simpler solution than creating additional subclasses through inheritance.  A decorator is implemented by creating a class that wraps access to another class.  The decorator implements the exact same public interface as it’s inner member.  That sounds like a lot of gobbledy-gook to me too, so let’s jump into a code sample.

Click here to see the full article.

[Via Jeremy D. Miller — The Shade Tree Developer]