private static Attribute[] InternalGetCustomAttributes(PropertyInfo element, Type type, bool inherit)
{
// walk up the hierarchy chain
Attribute[] attributes = (Attribute[])element.GetCustomAttributes(type, inherit);
if (!inherit)
return attributes;
// create the hashtable that keeps track of inherited types
Hashtable types = new Hashtable(11);
// create an array list to collect all the requested attibutes
ArrayList attributeList = new ArrayList();
CopyToArrayList(attributeList, attributes, types);
PropertyInfo baseProp = GetParentDefinition(element);
while (baseProp != null)
{
attributes = GetCustomAttributes(baseProp, type, false);
AddAttributesToList(attributeList, attributes, types);
baseProp = GetParentDefinition(baseProp);
}
return (Attribute[])attributeList.ToArray(type);
}