Exemple #1
0
        private void CopyCustomAttributesByImportAttribute(ICustomAttributeProvider targetMember,
			ICustomAttributeProvider yourMember, ImportCustomAttributesAttribute importAttribute)
        {
            if (importAttribute == null) return;
            var legalAttributes = importAttribute.AttributeTypes.Cast<TypeReference>().Select(x => x.Name);
            Func<CustomAttribute, bool> importOnly = attr => legalAttributes.Contains(attr.AttributeType.Name);
            CopyCustomAttributes(targetMember, yourMember, importOnly);
        }
Exemple #2
0
        private void CopyCustomAttributesByImportAttribute(ICustomAttributeProvider targetMember,
                                                           ICustomAttributeProvider yourMember, ImportCustomAttributesAttribute importAttribute)
        {
            if (importAttribute == null)
            {
                return;
            }
            var legalAttributes = importAttribute.AttributeTypes.Cast <TypeReference>().Select(x => x.Name);
            Func <CustomAttribute, bool> importOnly = attr => legalAttributes.Contains(attr.AttributeType.Name);

            CopyCustomAttributes(targetMember, yourMember, importOnly);
        }