Back to: Design Patterns in C# With Real-Time Examples
Structural Design Patterns in C#
In this article, I am going to give a brief introduction to Structural Design Pattern in C#. Please read our previous article where we discussed the Creational Design Patterns in C# with examples. As part of this article, we are going to discuss the following three things.
- What is Structural Design Pattern?
- When to use the Structural Design Pattern?
- Examples of Structural Design Pattern
What is Structural Design Pattern in C#?
According to Wikipedia, in software engineering, Structural Design Patterns are design patterns that ease the design by identifying a simple way to realize the relationship among entities. In simple words, we can say that the Structural Design Pattern is basically used to manage the structure of classes and interface as well as manage the relationship between the classes.
When to use Structural Design Patterns in C#?
In real-time applications, sometimes we need to change the structure of a class or the relationship among the classes but we don’t want this change to be affected by the project. For example, if we have two classes let say User and Product. And the Product class is used inside the User class making one-to-many relationships between the User and Product. Tomorrow, the structure or the relationships between these two classes change. The customer now wants to keep away the Product class from the User class, as they want to use the User and Product class independently. This is actually a structural change and we don’t want this structural change to affect our project. This is where the Structural Design Pattern helps us.
Examples of Structural Design Patterns in C#:
The following is the list of Structural Design Patterns.
- Adapter Design Pattern
- Facade Design Pattern
- Decorator Design Pattern
- Bridge Design Pattern
- Composite Design Pattern
- Proxy Design Pattern
- Flyweight Design Pattern
In the next article, I am going to discuss the Adapter Design Pattern in C# with examples. Here, in this article, I try to give a brief introduction to Structural Design Patterns. I hope you understood the need and use of the Structural Design Pattern in C#.