Are attributes an example of decorator?

The decorator pattern is used when there is a need to dynamically add responsibilities to the class, and when subclasses will be impossible due to the large number of subclasses that may arise.

Given the above definition, I would think that attributes are a decorator. Or can it be considered a proxy or adapter?

Thoughts?

+4
source share
1 answer

Yes, .NET attributes are basically their way of implementing a decorator pattern.

+3
source

Source: https://habr.com/ru/post/1340755/


All Articles