C#: How to add an attributes to an object at run-time?

后端 未结 7 1965
孤独总比滥情好
孤独总比滥情好 2020-12-30 09:00

As an entity class, I want to add an attributes at run-time, how should I do?

7条回答
  •  渐次进展
    2020-12-30 09:04

    I would go with PostSharp, a very elegant AOP framework (or Policy Injection).

    PostSharp allows you to inject custom attributes.
    The blog entry refered to in the post has some code you can download to achieve your goal.

提交回复
热议问题