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

后端 未结 7 1931
孤独总比滥情好
孤独总比滥情好 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:30

    Edit: please clarify, are you talking about c# attributes or members on your class?

    The only way you can add c# attributes is to generate a completely new class with the additional attributes, compile and load the new assembly to your existing AppDomain.

提交回复
热议问题