Inheritance of Custom Attributes on Abstract Properties

前端 未结 5 1537
萌比男神i
萌比男神i 2020-12-01 20:42

I\'ve got a custom attribute that I want to apply to my base abstract class so that I can skip elements that don\'t need to be viewed by the user when displaying the item in

5条回答
  •  悲哀的现实
    2020-12-01 20:58

    You can use

    PropertyInfo::GetCustomAttributes(true)
    

    which works fine, see example: https://dotnetfiddle.net/2IhEWH

    so, there is no need to use static method

    System.Attribute.GetCustomAttributes
    

提交回复
热议问题