开发者

Attributes are an example of Decorator?

开发者 https://www.devze.com 2023-02-13 03:15 出处:网络
The decorator pattern applies when there is a need to dynamically add responsibilitie开发者_运维百科s to a class, and when subclassing would be impossible due to the large number of subclasses that co

The decorator pattern applies when there is a need to dynamically add responsibilitie开发者_运维百科s to a class, and when subclassing would be impossible due to the large number of subclasses that could result.

Given above definition I would think attributes is decorator. Or could it be considered Proxy or Adapter?

Thoughts?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消