How to I get the property belonging to a custom attribute?

前端 未结 2 2067
离开以前
离开以前 2021-02-20 16:04

I need to find the type of the property that a custom attribute is applied to from within the custom attribute.

For example:

[MyAttribute]
string MyProp         


        
2条回答
  •  温柔的废话
    2021-02-20 16:38

    The custom attribute knows nothing about the attributed element so I don't think what you want is possible to do unless you enumerate all types in your system and check if they contain such attribute.

提交回复
热议问题