I do not agree with the answer of Paul.
First, properties are only syntactic sugar around methods + additional metadata. And I do not remember something, that there was some fundamental difference at the level of the CLR from the methods (if there is, then proof in the studio, I will be very happy to learn something new).
Secondly, just look at the implementation of MethodInfo.GetCustomAttribute . There you will see that all the work is done in the CustomAttribute.GetCustomAttributes method in which the value of the inherit parameter is inherit and if it is true , then the attributes of the base class are analyzed.
Now, look at the CustomAttributeExtensions.GetCustomAttributes extension CustomAttributeExtensions.GetCustomAttributes . This method, unlike the instance method MemberInfo.GetCustomAttribute has no restrictions on properties and simply pulls the CustomAttributeExtensions.InternalGetCustomAttribute method which, like in the case of method attributes earlier, simply passes the inheritance hierarchs manually.
Now, to the original question: why doesn't MemberInfo.GetCustomAttributes work for properties? I think that someone initially made a mistake, and such errors cannot be fixed without breaking existing customers. So then I had to add extension methods that corrected the situation and allowed to return the functionality missed initially.
And about the CLR ... It is not true, it seems :))
Microsoft, who wrote this method. - Denis BubnovMicrosoftdevelopers, you and I can only guess and guess why. - Denis Bubnov