When should I use attribute in C#?

后端 未结 5 597
旧巷少年郎
旧巷少年郎 2020-12-08 04:03

I saw some of the examples of utilize attribute, e.g. (as a map for dynamic factory) http://msdn.microsoft.com/en-us/magazine/cc164170.aspx

Just wondering what is th

5条回答
  •  感情败类
    2020-12-08 04:33

    My recommendation: use attributes to state facts about mechanisms, but not to model aspects of your business domain.

    More details:

    https://docs.microsoft.com/en-us/archive/blogs/ericlippert/properties-vs-attributes

提交回复
热议问题