Beispiel #1
0
        internal List <CustomAttributeData> GetCustomAttributes(int metadataToken, Type attributeType)
        {
            List <CustomAttributeData> list = new List <CustomAttributeData>();

            foreach (int i in CustomAttribute.Filter(metadataToken))
            {
                if (attributeType == null)
                {
                    list.Add(new CustomAttributeData(this, i));
                }
                else
                {
                    ConstructorInfo constructor = (ConstructorInfo)ResolveMethod(CustomAttribute.records[i].Type);
                    if (attributeType.IsAssignableFrom(constructor.DeclaringType))
                    {
                        list.Add(new CustomAttributeData(this, i));
                    }
                }
            }
            return(list);
        }