GetCustomAttributes() public method

public GetCustomAttributes ( Type attributeType, bool inherit ) : Object[]
attributeType Type
inherit bool
return Object[]
示例#1
0
		private void WriteCustomAttributes(XmlWriter writer, Module module) 
		{
			WriteCustomAttributes(writer, module.GetCustomAttributes(this.rep.DocumentInheritedAttributes), "module");
		}
示例#2
0
		public static Attribute GetCustomAttribute (Module element, Type attributeType, bool inherit)
		{
			// neither parameter is allowed to be null
			CheckParameters (element, attributeType);

			// Module inheritance hierarchies CAN NOT be searched for attributes, so the second
			// parameter of GetCustomAttributes () is IGNORED.
			object[] attributes = element.GetCustomAttributes (attributeType, inherit);

			return FindAttribute (attributes);
		}
示例#3
0
		public static Attribute[] GetCustomAttributes (Module element, Type attributeType, bool inherit)
		{
			// element parameter is not allowed to be null
			CheckParameters (element, attributeType);

			return (Attribute []) element.GetCustomAttributes (attributeType, inherit);
		}
示例#4
0
        public static Attribute[] GetCustomAttributes(Module element, bool inherit)
        {
            if (element == null)
                throw new ArgumentNullException(nameof(element));
            Contract.EndContractBlock();

            return (Attribute[])element.GetCustomAttributes(typeof(Attribute), inherit);
        }
示例#5
0
        public static Attribute[] GetCustomAttributes(Module element, Type attributeType, bool inherit)
        {
            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 (Attribute[])element.GetCustomAttributes(attributeType, inherit);
        }
示例#6
0
 public static bool HasCustomAttribute <T>(this Module element) where T : Attribute
 => element.GetCustomAttributes <T>().FirstOrDefault() != null;
 public static ILookup<string, string> GetElements(Module module)
 {
     return module.GetCustomAttributes(typeof(ElementalAttribute))
         .Cast<ElementalAttribute>()
         .MakeLookup();
 }
 public static Attribute[] GetCustomAttributes(Module element, bool inherit)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return (Attribute[]) element.GetCustomAttributes(typeof(Attribute), inherit);
 }
 public static Attribute[] GetCustomAttributes(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 (Attribute[]) element.GetCustomAttributes(attributeType, inherit);
 }
 internal static Object[] GetCustomAttributes(Module target, Type caType, bool inherit) {
   if (!target.Assembly.ReflectionOnly)
     return target.GetCustomAttributes(caType, inherit);
   return CustomAttribute.ExtractCustomAttribute(CustomAttributeData.GetCustomAttributes(target), caType);
 }
示例#11
0
 public static IList <CustomAttributeData> GetCustomAttributes(Module target)
 {
     return(GetData(target.GetCustomAttributes(true)));
 }
示例#12
0
 public override object[] GetCustomAttributesImpl(Module mod, Type attributeType, bool inherit)
 {
     System.Diagnostics.Debug.WriteLine("In GetCustomAttributesImpl 1");
     #if !DEBUG || true
     var name = mod.Name;
     if (mod.Name.Contains("IKVM.OpenJDK") || name.Contains("CodenameOne") || name.Contains("HelloWindows"))
     {
         return new JavaModuleAttribute[] { new JavaModuleAttribute() };
     }
     #endif
     var s = mod.GetCustomAttributes(attributeType).ToArray();
     return s;
 }
示例#13
0
 public static IEnumerable <T> GetCustomAttributes <T>(this Module element) where T : Attribute
 {
     return((IEnumerable <T>)element.GetCustomAttributes(typeof(T)));
 }
示例#14
0
		public static Attribute[] GetCustomAttributes (Module element, bool inherit)
		{
			// element parameter is not allowed to be null
			CheckParameters (element, typeof (Attribute));

			return (Attribute []) element.GetCustomAttributes (inherit);
		}