IsDefined() public method

public IsDefined ( Type attributeType, bool inherit ) : bool
attributeType Type
inherit bool
return bool
Exemplo n.º 1
0
        public static bool IsDefined(Module element, Type attributeType, bool inherit)
        {
            // Returns true is a custom attribute subclass of attributeType class/interface with no inheritance walk
            if (element == null)
                throw new ArgumentNullException(nameof(element));

            if (attributeType == null)
                throw new ArgumentNullException(nameof(attributeType));

            if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
            Contract.EndContractBlock();

            return element.IsDefined(attributeType,false);
        }
Exemplo n.º 2
0
		public static bool IsDefined (Module element, Type attributeType, bool inherit)
		{
			CheckParameters (element, attributeType);

			return element.IsDefined (attributeType, inherit);
		}
 public static bool IsDefined(Module element, Type attributeType, bool inherit)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     if (attributeType == null)
     {
         throw new ArgumentNullException("attributeType");
     }
     if (!attributeType.IsSubclassOf(typeof(Attribute)) && (attributeType != typeof(Attribute)))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
     }
     return element.IsDefined(attributeType, false);
 }