Beispiel #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
 }
Beispiel #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
        }
Beispiel #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
        }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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
        }