The Decorator Pattern & Extension Methods in c#

前端 未结 5 1987
情歌与酒
情歌与酒 2021-02-04 01:59

Before going to describe my problem first,I would like to define definitions of Decorator and Extension method Decorator

Attach additiona

5条回答
  •  太阳男子
    2021-02-04 02:34

    Extension methods are not a replacement for the decorator pattern. Extension methods work to provide functionality to an existing type without having to create a derived type.

    This is different from the traditional implementation to the decorator pattern. The decorator pattern allows you to dynamically provide multiple behaviors to an object at runtime without having to create a new subclass for each combination of those behaviors.

提交回复
热议问题