CopyToArrayList() private static méthode

private static CopyToArrayList ( ArrayList attributeList, Attribute attributes, Hashtable types ) : void
attributeList ArrayList
attributes Attribute
types Hashtable
Résultat void
Exemple #1
0
        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));
        }
Exemple #2
0
        private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
        {
            Attribute[] attributes = (Attribute[])element.GetCustomAttributes(type, inherit);
            if (!inherit)
            {
                return(attributes);
            }
            Dictionary <Type, AttributeUsageAttribute> types = new Dictionary <Type, AttributeUsageAttribute>(11);
            List <Attribute> attributeList = new List <Attribute>();

            Attribute.CopyToArrayList(attributeList, attributes, types);
            for (EventInfo parentDefinition = Attribute.GetParentDefinition(element); parentDefinition != (EventInfo)null; parentDefinition = Attribute.GetParentDefinition(parentDefinition))
            {
                Attribute[] customAttributes = Attribute.GetCustomAttributes((MemberInfo)parentDefinition, type, false);
                Attribute.AddAttributesToList(attributeList, customAttributes, types);
            }
            Array destinationArray = (Array)Attribute.CreateAttributeArrayHelper(type, attributeList.Count);

            Array.Copy((Array)attributeList.ToArray(), 0, destinationArray, 0, attributeList.Count);
            return((Attribute[])destinationArray);
        }