Just curious, see MemberInfo.GetCustomAttributes. Is it hinting that it may contain a non-Attribute object?
Just curious, see MemberInfo.GetCustomAttributes . Is it hinting that it may contain a non-Attribute
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is because the CLI specification doesn’t enforce that attributes derive from Attribute.
The specification, in II Part 21 (page 225), states:
Basically, the CLR itself can’t make a guarantee that the result will be Attribute – this is only true in CLS compliant languages. Non-CLS compliant languages are allowed to have attributes of any type, whic means ICustomAttributeProvider.GetCustomAttributes (which is the implemented interface in question) needs to provide a mechanism to get non-Attribute derived attributes.