Example #1
0
        public static IList<CustomAttributeData> GetCustomAttributes(MemberInfo target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            return target.GetCustomAttributesData();
        }
Example #2
0
 /// <summary>Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target member.</summary>
 /// <param name="target">The member whose attribute data is to be retrieved.</param>
 /// <returns>A list of objects that represent data about the attributes that have been applied to the target member.</returns>
 /// <exception cref="T:System.ArgumentNullException">
 ///         <paramref name="target" /> is <see langword="null" />.</exception>
 // Token: 0x06004408 RID: 17416 RVA: 0x000F92AE File Offset: 0x000F74AE
 public static IList <CustomAttributeData> GetCustomAttributes(MemberInfo target)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     return(target.GetCustomAttributesData());
 }
Example #3
0
            Member LoadMember(System.Reflection.MemberInfo refMember, bool loadAttributes)
            {
                Member member;

                if (refMember.MemberType == MemberTypes.NestedType)
                {
                    member = LoadType((System.Type)refMember, loadAttributes);
                }
                else if (refMember.MemberType == MemberTypes.Field)
                {
                    if (refMember.DeclaringType.IsEnum)
                    {
                        member = LoadEnumValue((FieldInfo)refMember);
                    }
                    else
                    {
                        member = LoadField((FieldInfo)refMember);
                    }
                }
                else if (refMember.MemberType == MemberTypes.Property)
                {
                    member = LoadProperty((PropertyInfo)refMember);
                }
                else if (refMember.MemberType == MemberTypes.Constructor)
                {
                    member = LoadConstructor((ConstructorInfo)refMember);
                }
                else if (refMember.MemberType == MemberTypes.Method)
                {
                    if (((MethodInfo)refMember).IsSpecialName)
                    {
                        member = null;
                    }
                    else
                    {
                        member = LoadMethod((MethodInfo)refMember);
                    }
                }
                else if (refMember.MemberType == MemberTypes.Event)
                {
                    member = LoadEvent((EventInfo)refMember);
                }
                else
                {
                    throw new NotSupportedException(
                              "Unsupported member type: " + refMember.MemberType + " " +
                              GetTypeFullName(refMember.DeclaringType) + "." + refMember.Name);
                }

                if (loadAttributes && member != null)
                {
                    member.CustomAttributes = LoadAttributes(refMember.GetCustomAttributesData());
                }

                return(member);
            }
        public override bool Filter(IFilterContext context, MemberInfo m)
        {
            IList<CustomAttributeData> data = m.GetCustomAttributesData();
            foreach (CustomAttributeData attrData in data)
            {
                if (attrData.Constructor.DeclaringType.Equals(typeof(CompilerGeneratedAttribute)))
                    return true;
            }

            return false;
        }
 static public int GetCustomAttributesData(IntPtr l)
 {
     try {
         System.Reflection.MemberInfo self = (System.Reflection.MemberInfo)checkSelf(l);
         var ret = self.GetCustomAttributesData();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        static StackObject *GetCustomAttributesData_8(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Reflection.MemberInfo instance_of_this_method = (System.Reflection.MemberInfo) typeof(System.Reflection.MemberInfo).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetCustomAttributesData();

            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
        public static IList <CustomAttributeData> GetCustomAttributes(MemberInfo target)
        {
            ArgumentNullException.ThrowIfNull(target);

            return(target.GetCustomAttributesData());
        }