Esempio n. 1
0
 public static AttributeMap[] Create(TypeModel model, MemberInfo member, bool inherit)
 {
     #if FEAT_IKVM
     System.Collections.Generic.IList<CustomAttributeData> all = member.__GetCustomAttributes(model.MapType(typeof(Attribute)), inherit);
     AttributeMap[] result = new AttributeMap[all.Count];
     int index = 0;
     foreach (CustomAttributeData attrib in all)
     {
         result[index++] = new AttributeDataMap(attrib);
     }
     return result;
     #else
     #if WINRT
     Attribute[] all = System.Linq.Enumerable.ToArray(member.GetCustomAttributes(inherit));
     #else
     var all = member.GetCustomAttributes(inherit);
     #endif
     var result = new AttributeMap[all.Length];
     for (var i = 0; i < all.Length; i++)
     {
         result[i] = new ReflectionAttributeMap((Attribute) all[i]);
     }
     return result;
     #endif
 }
Esempio n. 2
0
        public static AttributeMap[] Create(TypeModel model, Assembly assembly)
        {

#if FEAT_IKVM
            const bool inherit = false;
            System.Collections.Generic.IList<CustomAttributeData> all = assembly.__GetCustomAttributes(model.MapType(typeof(Attribute)), inherit);
            AttributeMap[] result = new AttributeMap[all.Count];
            int index = 0;
            foreach (CustomAttributeData attrib in all)
            {
                result[index++] = new AttributeDataMap(attrib);
            }
            return result;
#else
#if WINRT || COREFX
            Attribute[] all = System.Linq.Enumerable.ToArray(assembly.GetCustomAttributes());
#else
            const bool inherit = false;
            object[] all = assembly.GetCustomAttributes(inherit);
#endif
            AttributeMap[] result = new AttributeMap[all.Length];
            for(int i = 0 ; i < all.Length ; i++)
            {
                result[i] = new ReflectionAttributeMap((Attribute)all[i]);
            }
            return result;
#endif
        }
Esempio n. 3
0
        public static AttributeMap[] Create(TypeModel model, Type type, bool inherit)
        {
#if FEAT_IKVM
            Type attribType = model.MapType(typeof(System.Attribute));
            System.Collections.Generic.IList<CustomAttributeData> all = type.__GetCustomAttributes(attribType, inherit);
            AttributeMap[] result = new AttributeMap[all.Count];
            int index = 0;
            foreach (CustomAttributeData attrib in all)
            {
                result[index++] = new AttributeDataMap(attrib);
            }
            return result;
#else
#if WINRT || COREFX
            Attribute[] all = System.Linq.Enumerable.ToArray(type.GetTypeInfo().GetCustomAttributes(inherit));
#else
            object[] all = type.GetCustomAttributes(inherit);
#endif
            AttributeMap[] result = new AttributeMap[all.Length];
            for(int i = 0 ; i < all.Length ; i++)
            {
                result[i] = new ReflectionAttributeMap((Attribute)all[i]);
            }
            return result;
#endif
        }
Esempio n. 4
0
 public static AttributeMap[] Create(TypeModel model, Assembly assembly)
 {
     object[] customAttributes = assembly.GetCustomAttributes(false);
     AttributeMap[] array = new AttributeMap[customAttributes.Length];
     for (int i = 0; i < customAttributes.Length; i++)
     {
         array[i] = new AttributeMap.ReflectionAttributeMap((Attribute)customAttributes[i]);
     }
     return array;
 }
Esempio n. 5
0
 public static AttributeMap[] Create(TypeModel model, MemberInfo member, bool inherit)
 {
     object[] customAttributes = member.GetCustomAttributes(inherit);
     AttributeMap[] array = new AttributeMap[customAttributes.Length];
     for (int i = 0; i < customAttributes.Length; i++)
     {
         array[i] = new AttributeMap.ReflectionAttributeMap((Attribute)customAttributes[i]);
     }
     return array;
 }
Esempio n. 6
0
        public static AttributeMap[] Create(TypeModel model, Type type, bool inherit)

        {
#if FEAT_IKVM
            Type attribType = model.MapType(typeof(System.Attribute));

            System.Collections.Generic.IList <CustomAttributeData> all = type.__GetCustomAttributes(attribType, inherit);

            AttributeMap[] result = new AttributeMap[all.Count];

            int index = 0;

            foreach (CustomAttributeData attrib in all)

            {
                result[index++] = new AttributeDataMap(attrib);
            }

            return(result);
#else
#if WINRT
            Attribute[] all = System.Linq.Enumerable.ToArray(type.GetTypeInfo().GetCustomAttributes(inherit));
#else
            object[] all = type.GetCustomAttributes(inherit);
#endif

            AttributeMap[] result = new AttributeMap[all.Length];

            for (int i = 0; i < all.Length; i++)

            {
                result[i] = new ReflectionAttributeMap((Attribute)all[i]);
            }

            return(result);
#endif
        }