internal Attribute[] GetAttributes() {
Attribute[] ret = null;
memberHash.Clear();
Debug.WriteLineIf(CompDescrSwitch.TraceVerbose, "Getting attributes from " + owner.componentType.FullName);
// Before we reflect on the type attributes, do the same for the type's interfaces, if it implements any.
// We add these in reflection order.
//
Type[] interfaces = owner.componentType.GetInterfaces();
foreach(Type iface in interfaces) {
// only do this for public interfaces
//
if ((iface.Attributes & (TypeAttributes.Public | TypeAttributes.NestedPublic)) != 0) {
ReflectGetCustomAttributes(iface, typeof(Attribute));
}
}
// Now do the actual type. Last one in wins.
//
ReflectGetCustomAttributes(owner.componentType, typeof(Attribute));
// NOTE : You cannot combine designer attributes with the base class attributes.
// To find the designer you must get the attributes on this class, thus causing
// an infinite recursion... don't do that!
//
ret = new Attribute[memberHash.Values.Count];
memberHash.Values.CopyTo(ret, 0);
return ret;
}