There are some problems in getting custome attributes out of
ICustomAttributeProvider elements.
.NET offers two basic ways:
1. Using the method 'GetCustomAttributes' directly on an
ICustomAttributeProvider element
2. Using the  static overloaded method Attribute.GetCustomAttribute on
the element.
 
It terms to be that these methods behave differently, when dealing with
inherited attributes.
For example:
 
EventInfo ev = ....
ev.GetCustomAttributes(typeof(MyAttribute), true)   --> this will not
search in the parent class for inherited attributes.
 
Attribute.GetCustomAttributes(ev, typeof(MyAttribute), true)  --> this
will go and search for inherited attributes in the parent class.
 
The attached path fixes the but, and some test-cases are provided, too.
Please review.
Regards, Roei Erez

Attachment: ReflectionPatch.patch
Description: ReflectionPatch.patch

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to