private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
{
Attribute[] attributes = (Attribute[])element.GetCustomAttributes(type, inherit);
if (!inherit)
{
return(attributes);
}
Hashtable types = new Hashtable(11);
ArrayList attributeList = new ArrayList();
Attribute.CopyToArrayList(attributeList, attributes, types);
for (EventInfo parentDefinition = Attribute.GetParentDefinition(element); parentDefinition != null; parentDefinition = Attribute.GetParentDefinition(parentDefinition))
{
Attribute[] customAttributes = Attribute.GetCustomAttributes((MemberInfo)parentDefinition, type, false);
Attribute.AddAttributesToList(attributeList, customAttributes, types);
}
return((Attribute[])attributeList.ToArray(type));
}