ReSharper
 
Get ReSharper
You are viewing the documentation for an earlier version of ReSharper.

Create a decorator

Last modified: 21 July 2022

The Decorator design pattern is used to dynamically add additional behavior to an object. In addition, by using interfaces, a decorator can be used to unify types in a manner similar to multiple inheritance.

Let’s take an example – suppose you have two objects, called Bird and Lizard, that you want to put into a Decorator: