static private CustomAttribute GetCustomAttributeList(MemberInfo member, Type caType, CustomAttribute caItem, int level)
        {
            MemberTypes memberType = member.MemberType;
            int         token      = CustomAttribute.GetMemberToken(member, memberType);
            IntPtr      module     = CustomAttribute.GetMemberModule(member, memberType);

            return(CustomAttribute.GetCustomAttributeListCheckType(token, module, caType, caItem, level));
        }
        static internal Object[] GetCAReturnValue(RuntimeMethodInfo method, Type caType, bool inherit)
        {
            int token = CustomAttribute.GetMethodRetValueToken(method);

            if (token != 0)
            {
                IntPtr          module = CustomAttribute.GetMemberModule(method, MemberTypes.Method);
                CustomAttribute caItem = CustomAttribute.GetCustomAttributeListCheckType(token, module, caType, null, 0);
                return(CustomAttribute.CheckConsistencyAndCreateArray(caItem, caType));
            }
            return((caType == null || caType.IsValueType) ? s_gObjectEmptyArray : (Object[])Array.CreateInstance(caType, 0));
        }
        static internal Object[] GetCustomAttributes(ParameterInfo param, Type caType, bool inherit)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }

            int             token  = param.GetToken();
            IntPtr          module = param.GetModule();
            CustomAttribute caItem = CustomAttribute.GetCustomAttributeListCheckType(token, module, caType, null, 0);

            return(CustomAttribute.CheckConsistencyAndCreateArray(caItem, caType));
        }
        static internal Object[] GetCustomAttributes(Module module, Type caType)
        {
            if (module == null)
            {
                throw new ArgumentNullException("module");
            }

            int token = CustomAttribute.GetModuleToken(module);

            if (token != 0)
            {
                IntPtr          mod    = CustomAttribute.GetModuleModule(module);
                CustomAttribute caItem = CustomAttribute.GetCustomAttributeListCheckType(token, mod, caType, null, 0);
                return(CustomAttribute.CheckConsistencyAndCreateArray(caItem, caType));
            }
            return((caType == null || caType.IsValueType) ? s_gObjectEmptyArray : (Object[])Array.CreateInstance(caType, 0));
        }