The decorator design pattern allows you to dynamically add behavior to your classes without modifying the original class. This allows you to layer in new functionality to a class while keeping different concerns cleanly separated.
The decorator design pattern allows you to dynamically add behavior to your classes without modifying the original class. This allows you to layer in new functionality to a class while keeping different concerns cleanly separated. The decorator pattern is especially useful for when you need to apply cross cutting concerns like logging, authorization, and caching, but can also be used to modify data passed to and from an object. Understanding how to apply the decorator pattern gives you a powerful tool when you need to add behavior to and extend the functionality of your classes.
David Berry is a software engineer with over 15 years of experience developing applications in languages such as Java and C#. Throughout his career, he has worked extensively with enterprise database systems including Oracle and SQL Server.
Course Overview Hello everyone. My name is David Berry, and welcome to my course, C# Design Patterns: Decorator. I'm a Pluralsight author, and in this course we're going to learn about one of the classic Gang of Four design patterns, the decorator. The decorator pattern allows you to dynamically add functionality to classes without modifying the target class. It does this by creating a wrapper around the original class, which gives you an extension point to inject in new behavior. In this course, I'll show you how the decorator pattern works. We'll code up and apply a couple of decorator classes ourselves, and we'll see where the decorator pattern is used within .NET itself. Before starting this course, you should be comfortable with object‑oriented concepts in C#, especially the use of interfaces. By the end of this course, you'll know everything you need to know about how to use the decorator pattern in your projects. I hope you'll join me on this journey to learn the decorator design pattern in C# with this course on Pluralsight.