[Mono-dev] patch for System.Reflection

Roei Erez roeie at mainsoft.com
Sun Jan 21 04:49:22 EST 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070121/cb2755c6/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ReflectionPatch.patch
Type: application/octet-stream
Size: 14685 bytes
Desc: ReflectionPatch.patch
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070121/cb2755c6/attachment.obj 


More information about the Mono-devel-list mailing list