public static void AddIfNotExists(CustomAttributeCollection customAttributes)
 {
     if (!IsDefined(customAttributes))
     {
         Build(customAttributes.Add());
     }
 }
예제 #2
0
        public void InjectAttributeOn(ICustomAttributeProvider provider, string attributeType)
        {
            //Info("{1}: {0}", provider, attributeType);
            CustomAttributeCollection attributes = provider.CustomAttributes;

            attributes.Add(new CustomAttribute(DefaultConstructorReferenceFor(attributeType)));
        }
예제 #3
0
        void AddSecurityAttribute(ICustomAttributeProvider provider, AttributeType type)
        {
            if (HasSecurityAttribute(provider, type))
            {
                return;
            }

            CustomAttributeCollection attributes = provider.CustomAttributes;

            switch (type)
            {
            case AttributeType.Critical:
                attributes.Add(CreateCriticalAttribute());
                break;

            case AttributeType.SafeCritical:
                attributes.Add(CreateSafeCriticalAttribute());
                break;
            }
        }