internal static bool IsDefined(RuntimeType type, RuntimeType caType, bool inherit)
 {
     if (type.GetElementType() != null)
     {
         return(false);
     }
     if (PseudoCustomAttribute.IsDefined(type, caType))
     {
         return(true);
     }
     if (CustomAttribute.IsCustomAttributeDefined(type.GetRuntimeModule(), type.MetadataToken, caType))
     {
         return(true);
     }
     if (!inherit)
     {
         return(false);
     }
     type = (type.BaseType as RuntimeType);
     while (type != null)
     {
         if (CustomAttribute.IsCustomAttributeDefined(type.GetRuntimeModule(), type.MetadataToken, caType, 0, inherit))
         {
             return(true);
         }
         type = (type.BaseType as RuntimeType);
     }
     return(false);
 }
Esempio n. 2
0
        internal static Attribute[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType, bool includeSecCa, out int count)
        {
            count = 0;
            bool flag = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute);

            if (!flag && PseudoCustomAttribute.s_pca.GetValueOrDefault(caType) == null && !PseudoCustomAttribute.IsSecurityAttribute(caType))
            {
                return(new Attribute[0]);
            }
            List <Attribute> list = new List <Attribute>();

            if (includeSecCa && (flag || PseudoCustomAttribute.IsSecurityAttribute(caType)))
            {
                object[] array;
                PseudoCustomAttribute.GetSecurityAttributes(ctor.Module.ModuleHandle.GetRuntimeModule(), ctor.MetadataToken, false, out array);
                if (array != null)
                {
                    foreach (object obj in array)
                    {
                        if (caType == obj.GetType() || obj.GetType().IsSubclassOf(caType))
                        {
                            list.Add((Attribute)obj);
                        }
                    }
                }
            }
            count = list.Count;
            return(list.ToArray());
        }
 internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType caType, bool inherit)
 {
     if (PseudoCustomAttribute.IsDefined(method, caType))
     {
         return(true);
     }
     if (CustomAttribute.IsCustomAttributeDefined(method.GetRuntimeModule(), method.MetadataToken, caType))
     {
         return(true);
     }
     if (!inherit)
     {
         return(false);
     }
     method = method.GetParentDefinition();
     while (method != null)
     {
         if (CustomAttribute.IsCustomAttributeDefined(method.GetRuntimeModule(), method.MetadataToken, caType, 0, inherit))
         {
             return(true);
         }
         method = method.GetParentDefinition();
     }
     return(false);
 }
Esempio n. 4
0
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(e, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType));
 }
Esempio n. 5
0
 internal static bool IsDefined(RuntimeAssembly assembly, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(assembly, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(assembly.ManifestModule as RuntimeModule, RuntimeAssembly.GetToken(assembly.GetNativeHandle()), caType));
 }
Esempio n. 6
0
 internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(parameter, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(parameter.GetRuntimeModule(), parameter.MetadataToken, caType));
 }
Esempio n. 7
0
 internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(field, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(field.GetRuntimeModule(), field.MetadataToken, caType));
 }
Esempio n. 8
0
 internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(ctor, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(ctor.GetRuntimeModule(), ctor.MetadataToken, caType));
 }
Esempio n. 9
0
 internal static bool IsDefined(RuntimePropertyInfo property, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(property, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(property.GetRuntimeModule(), property.MetadataToken, caType));
 }
Esempio n. 10
0
        internal static bool IsDefined(RuntimeModule module, RuntimeType caType)
        {
            if (PseudoCustomAttribute.IsDefined(module, caType))
            {
                return(true);
            }
            RuntimeModule decoratedModule     = module;
            int           metadataToken       = decoratedModule.MetadataToken;
            RuntimeType   attributeFilterType = caType;

            return(CustomAttribute.IsCustomAttributeDefined(decoratedModule, metadataToken, attributeFilterType));
        }
Esempio n. 11
0
        internal static object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType)
        {
            int count = 0;

            Attribute[] customAttributes1 = PseudoCustomAttribute.GetCustomAttributes(parameter, caType, out count);
            object[]    customAttributes2 = CustomAttribute.GetCustomAttributes(parameter.GetRuntimeModule(), parameter.MetadataToken, count, caType, !CustomAttribute.AllowCriticalCustomAttributes(parameter));
            if (count > 0)
            {
                Array.Copy((Array)customAttributes1, 0, (Array)customAttributes2, customAttributes2.Length - count, count);
            }
            return(customAttributes2);
        }
Esempio n. 12
0
        internal static object[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType)
        {
            int count = 0;

            Attribute[] sourceArray      = PseudoCustomAttribute.GetCustomAttributes(ctor, caType, true, out count);
            object[]    destinationArray = GetCustomAttributes(ctor.Module, ctor.MetadataToken, count, caType);
            if (count > 0)
            {
                Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
            }
            return(destinationArray);
        }
        internal static object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType)
        {
            int num = 0;

            Attribute[] customAttributes  = PseudoCustomAttribute.GetCustomAttributes(parameter, caType, out num);
            object[]    customAttributes2 = CustomAttribute.GetCustomAttributes(parameter.GetRuntimeModule(), parameter.MetadataToken, num, caType, !CustomAttribute.AllowCriticalCustomAttributes(parameter));
            if (num > 0)
            {
                Array.Copy(customAttributes, 0, customAttributes2, customAttributes2.Length - num, num);
            }
            return(customAttributes2);
        }
Esempio n. 14
0
        internal static object[] GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
        {
            int count = 0;

            Attribute[] sourceArray      = PseudoCustomAttribute.GetCustomAttributes(property, caType, out count);
            object[]    destinationArray = GetCustomAttributes(property.Module, property.MetadataToken, count, caType);
            if (count > 0)
            {
                Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
            }
            return(destinationArray);
        }
        internal static object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType)
        {
            int count = 0;

            Attribute[] sourceArray      = PseudoCustomAttribute.GetCustomAttributes(parameter, caType, out count);
            object[]    destinationArray = GetCustomAttributes(parameter.GetRuntimeModule(), parameter.MetadataToken, count, caType, !AllowCriticalCustomAttributes(parameter));
            if (count > 0)
            {
                Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
            }
            return(destinationArray);
        }
Esempio n. 16
0
        internal static object[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType)
        {
            int count = 0;

            Attribute[] customAttributes1 = PseudoCustomAttribute.GetCustomAttributes(ctor, caType, true, out count);
            object[]    customAttributes2 = CustomAttribute.GetCustomAttributes(ctor.GetRuntimeModule(), ctor.MetadataToken, count, caType, !CustomAttribute.AllowCriticalCustomAttributes((MethodBase)ctor));
            if (count > 0)
            {
                Array.Copy((Array)customAttributes1, 0, (Array)customAttributes2, customAttributes2.Length - count, count);
            }
            return(customAttributes2);
        }
Esempio n. 17
0
        internal static object[] GetCustomAttributes(Assembly assembly, RuntimeType caType)
        {
            int count = 0;

            Attribute[] sourceArray      = PseudoCustomAttribute.GetCustomAttributes(assembly, caType, out count);
            object[]    destinationArray = GetCustomAttributes(assembly.ManifestModule, assembly.AssemblyHandle.GetToken(), count, caType);
            if (count > 0)
            {
                Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
            }
            return(destinationArray);
        }
        internal static object[] GetCustomAttributes(RuntimeModule module, RuntimeType caType)
        {
            int num = 0;

            Attribute[] customAttributes = PseudoCustomAttribute.GetCustomAttributes(module, caType, out num);
            bool        isDecoratedTargetSecurityTransparent = module.GetRuntimeAssembly().IsAllSecurityTransparent();

            object[] customAttributes2 = CustomAttribute.GetCustomAttributes(module, module.MetadataToken, num, caType, isDecoratedTargetSecurityTransparent);
            if (num > 0)
            {
                Array.Copy(customAttributes, 0, customAttributes2, customAttributes2.Length - num, num);
            }
            return(customAttributes2);
        }
Esempio n. 19
0
        internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
        {
            int count = 0;

            Attribute[] customAttributes1 = PseudoCustomAttribute.GetCustomAttributes(e, caType, out count);
            bool        isDecoratedTargetSecurityTransparent = e.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();

            object[] customAttributes2 = CustomAttribute.GetCustomAttributes(e.GetRuntimeModule(), e.MetadataToken, count, caType, isDecoratedTargetSecurityTransparent);
            if (count > 0)
            {
                Array.Copy((Array)customAttributes1, 0, (Array)customAttributes2, customAttributes2.Length - count, count);
            }
            return(customAttributes2);
        }
        internal static object[] GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
        {
            int count = 0;

            Attribute[] sourceArray = PseudoCustomAttribute.GetCustomAttributes(property, caType, out count);
            bool        isDecoratedTargetSecurityTransparent = property.GetRuntimeModule().GetRuntimeAssembly().IsAllSecurityTransparent();

            object[] destinationArray = GetCustomAttributes(property.GetRuntimeModule(), property.MetadataToken, count, caType, isDecoratedTargetSecurityTransparent);
            if (count > 0)
            {
                Array.Copy(sourceArray, 0, destinationArray, destinationArray.Length - count, count);
            }
            return(destinationArray);
        }
Esempio n. 21
0
        internal static Attribute[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool includeSecCa, out int count)
        {
            count = 0;
            bool flag = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute);

            if (!flag && PseudoCustomAttribute.s_pca.GetValueOrDefault(caType) == null && !PseudoCustomAttribute.IsSecurityAttribute(caType))
            {
                return(new Attribute[0]);
            }
            List <Attribute> list = new List <Attribute>();

            if (flag || caType == (RuntimeType)typeof(SerializableAttribute))
            {
                Attribute customAttribute = SerializableAttribute.GetCustomAttribute(type);
                if (customAttribute != null)
                {
                    list.Add(customAttribute);
                }
            }
            if (flag || caType == (RuntimeType)typeof(ComImportAttribute))
            {
                Attribute customAttribute = ComImportAttribute.GetCustomAttribute(type);
                if (customAttribute != null)
                {
                    list.Add(customAttribute);
                }
            }
            if (includeSecCa && (flag || PseudoCustomAttribute.IsSecurityAttribute(caType)) && !type.IsGenericParameter && type.GetElementType() == null)
            {
                if (type.IsGenericType)
                {
                    type = (RuntimeType)type.GetGenericTypeDefinition();
                }
                object[] array;
                PseudoCustomAttribute.GetSecurityAttributes(type.Module.ModuleHandle.GetRuntimeModule(), type.MetadataToken, false, out array);
                if (array != null)
                {
                    foreach (object obj in array)
                    {
                        if (caType == obj.GetType() || obj.GetType().IsSubclassOf(caType))
                        {
                            list.Add((Attribute)obj);
                        }
                    }
                }
            }
            count = list.Count;
            return(list.ToArray());
        }
 internal static object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit)
 {
     if (type.GetElementType() != null)
     {
         if (!caType.IsValueType)
         {
             return(CustomAttribute.CreateAttributeArrayHelper(caType, 0));
         }
         return(EmptyArray <object> .Value);
     }
     else
     {
         if (type.IsGenericType && !type.IsGenericTypeDefinition)
         {
             type = (type.GetGenericTypeDefinition() as RuntimeType);
         }
         int         i = 0;
         Attribute[] customAttributes = PseudoCustomAttribute.GetCustomAttributes(type, caType, true, out i);
         if (!inherit || (caType.IsSealed && !CustomAttribute.GetAttributeUsage(caType).Inherited))
         {
             object[] customAttributes2 = CustomAttribute.GetCustomAttributes(type.GetRuntimeModule(), type.MetadataToken, i, caType, !CustomAttribute.AllowCriticalCustomAttributes(type));
             if (i > 0)
             {
                 Array.Copy(customAttributes, 0, customAttributes2, customAttributes2.Length - i, i);
             }
             return(customAttributes2);
         }
         List <object> list = new List <object>();
         bool          mustBeInheritable = false;
         Type          elementType       = (caType == null || caType.IsValueType || caType.ContainsGenericParameters) ? typeof(object) : caType;
         while (i > 0)
         {
             list.Add(customAttributes[--i]);
         }
         while (type != (RuntimeType)typeof(object) && type != null)
         {
             object[] customAttributes3 = CustomAttribute.GetCustomAttributes(type.GetRuntimeModule(), type.MetadataToken, 0, caType, mustBeInheritable, list, !CustomAttribute.AllowCriticalCustomAttributes(type));
             mustBeInheritable = true;
             for (int j = 0; j < customAttributes3.Length; j++)
             {
                 list.Add(customAttributes3[j]);
             }
             type = (type.BaseType as RuntimeType);
         }
         object[] array = CustomAttribute.CreateAttributeArrayHelper(elementType, list.Count);
         Array.Copy(list.ToArray(), 0, array, 0, list.Count);
         return(array);
     }
 }
Esempio n. 23
0
        internal static object[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
        {
            int count = 0;

            Attribute[] customAttributes1 = PseudoCustomAttribute.GetCustomAttributes(assembly, caType, true, out count);
            int         token             = RuntimeAssembly.GetToken(assembly.GetNativeHandle());
            bool        isDecoratedTargetSecurityTransparent = assembly.IsAllSecurityTransparent();

            object[] customAttributes2 = CustomAttribute.GetCustomAttributes(assembly.ManifestModule as RuntimeModule, token, count, caType, isDecoratedTargetSecurityTransparent);
            if (count > 0)
            {
                Array.Copy((Array)customAttributes1, 0, (Array)customAttributes2, customAttributes2.Length - count, count);
            }
            return(customAttributes2);
        }
        internal static object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit)
        {
            if (type.GetElementType() != null)
            {
                if (!caType.IsValueType)
                {
                    return(CreateAttributeArrayHelper(caType, 0));
                }
                return(new object[0]);
            }
            if (type.IsGenericType && !type.IsGenericTypeDefinition)
            {
                type = type.GetGenericTypeDefinition() as RuntimeType;
            }
            int count = 0;

            Attribute[] sourceArray = PseudoCustomAttribute.GetCustomAttributes(type, caType, true, out count);
            if (!inherit || (caType.IsSealed && !GetAttributeUsage(caType).Inherited))
            {
                object[] objArray = GetCustomAttributes(type.GetRuntimeModule(), type.MetadataToken, count, caType, !AllowCriticalCustomAttributes(type));
                if (count > 0)
                {
                    Array.Copy(sourceArray, 0, objArray, objArray.Length - count, count);
                }
                return(objArray);
            }
            List <object> derivedAttributes = new List <object>();
            bool          mustBeInheritable = false;
            Type          elementType       = (((caType == null) || caType.IsValueType) || caType.ContainsGenericParameters) ? typeof(object) : caType;

            while (count > 0)
            {
                derivedAttributes.Add(sourceArray[--count]);
            }
            while ((type != ((RuntimeType)typeof(object))) && (type != null))
            {
                object[] objArray2 = GetCustomAttributes(type.GetRuntimeModule(), type.MetadataToken, 0, caType, mustBeInheritable, derivedAttributes, !AllowCriticalCustomAttributes(type));
                mustBeInheritable = true;
                for (int i = 0; i < objArray2.Length; i++)
                {
                    derivedAttributes.Add(objArray2[i]);
                }
                type = type.BaseType as RuntimeType;
            }
            object[] destinationArray = CreateAttributeArrayHelper(elementType, derivedAttributes.Count);
            Array.Copy(derivedAttributes.ToArray(), 0, destinationArray, 0, derivedAttributes.Count);
            return(destinationArray);
        }
Esempio n. 25
0
        internal static object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit)
        {
            if (type.GetElementType() != (Type)null)
            {
                if (!caType.IsValueType)
                {
                    return(CustomAttribute.CreateAttributeArrayHelper((Type)caType, 0));
                }
                return(EmptyArray <object> .Value);
            }
            if (type.IsGenericType && !type.IsGenericTypeDefinition)
            {
                type = type.GetGenericTypeDefinition() as RuntimeType;
            }
            int count = 0;

            Attribute[] customAttributes1 = PseudoCustomAttribute.GetCustomAttributes(type, caType, true, out count);
            if (!inherit || caType.IsSealed && !CustomAttribute.GetAttributeUsage(caType).Inherited)
            {
                object[] customAttributes2 = CustomAttribute.GetCustomAttributes(type.GetRuntimeModule(), type.MetadataToken, count, caType, !CustomAttribute.AllowCriticalCustomAttributes(type));
                if (count > 0)
                {
                    Array.Copy((Array)customAttributes1, 0, (Array)customAttributes2, customAttributes2.Length - count, count);
                }
                return(customAttributes2);
            }
            List <object> objectList        = new List <object>();
            bool          mustBeInheritable = false;
            Type          elementType       = (caType == (RuntimeType)null || caType.IsValueType ? 1 : (caType.ContainsGenericParameters ? 1 : 0)) != 0 ? typeof(object) : (Type)caType;

            while (count > 0)
            {
                objectList.Add((object)customAttributes1[--count]);
            }
            for (; type != (RuntimeType)typeof(object) && type != (RuntimeType)null; type = type.BaseType as RuntimeType)
            {
                object[] customAttributes2 = CustomAttribute.GetCustomAttributes(type.GetRuntimeModule(), type.MetadataToken, 0, caType, mustBeInheritable, (IList)objectList, !CustomAttribute.AllowCriticalCustomAttributes(type));
                mustBeInheritable = true;
                for (int index = 0; index < customAttributes2.Length; ++index)
                {
                    objectList.Add(customAttributes2[index]);
                }
            }
            object[] attributeArrayHelper = CustomAttribute.CreateAttributeArrayHelper(elementType, objectList.Count);
            Array.Copy((Array)objectList.ToArray(), 0, (Array)attributeArrayHelper, 0, objectList.Count);
            return(attributeArrayHelper);
        }
Esempio n. 26
0
        internal static Attribute[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool includeSecCa, out int count)
        {
            count = 0;
            bool flag = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute);

            if (!flag && PseudoCustomAttribute.s_pca.GetValueOrDefault(caType) == (RuntimeType)null && !PseudoCustomAttribute.IsSecurityAttribute(caType))
            {
                return(new Attribute[0]);
            }
            List <Attribute> attributeList = new List <Attribute>();

            if (flag || caType == (RuntimeType)typeof(DllImportAttribute))
            {
                Attribute customAttribute = DllImportAttribute.GetCustomAttribute(method);
                if (customAttribute != null)
                {
                    attributeList.Add(customAttribute);
                }
            }
            if (flag || caType == (RuntimeType)typeof(PreserveSigAttribute))
            {
                Attribute customAttribute = PreserveSigAttribute.GetCustomAttribute(method);
                if (customAttribute != null)
                {
                    attributeList.Add(customAttribute);
                }
            }
            if (includeSecCa && (flag || PseudoCustomAttribute.IsSecurityAttribute(caType)))
            {
                object[] securityAttributes;
                PseudoCustomAttribute.GetSecurityAttributes(method.Module.ModuleHandle.GetRuntimeModule(), method.MetadataToken, false, out securityAttributes);
                if (securityAttributes != null)
                {
                    foreach (object obj in securityAttributes)
                    {
                        if ((Type)caType == obj.GetType() || obj.GetType().IsSubclassOf((Type)caType))
                        {
                            attributeList.Add((Attribute)obj);
                        }
                    }
                }
            }
            count = attributeList.Count;
            return(attributeList.ToArray());
        }
Esempio n. 27
0
        internal static IList <CustomAttributeData> GetCustomAttributesInternal(RuntimeFieldInfo target)
        {
            IList <CustomAttributeData> customAttributes = CustomAttributeData.GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
            int num = 0;

            Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, out num);
            if (num == 0)
            {
                return(customAttributes);
            }
            CustomAttributeData[] array = new CustomAttributeData[customAttributes.Count + num];
            customAttributes.CopyTo(array, num);
            for (int i = 0; i < num; i++)
            {
                array[i] = new CustomAttributeData(customAttributes2[i]);
            }
            return(Array.AsReadOnly <CustomAttributeData>(array));
        }
Esempio n. 28
0
        internal static IList <CustomAttributeData> GetCustomAttributesInternal(RuntimeParameterInfo target)
        {
            IList <CustomAttributeData> customAttributes1 = CustomAttributeData.GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
            int count = 0;

            Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, out count);
            if (count == 0)
            {
                return(customAttributes1);
            }
            CustomAttributeData[] array = new CustomAttributeData[customAttributes1.Count + count];
            customAttributes1.CopyTo(array, count);
            for (int index = 0; index < count; ++index)
            {
                array[index] = new CustomAttributeData(customAttributes2[index]);
            }
            return((IList <CustomAttributeData>)Array.AsReadOnly <CustomAttributeData>(array));
        }
Esempio n. 29
0
        internal static IList <CustomAttributeData> GetCustomAttributesInternal(RuntimeAssembly target)
        {
            IList <CustomAttributeData> customAttributes = CustomAttributeData.GetCustomAttributes((RuntimeModule)target.ManifestModule, RuntimeAssembly.GetToken(target.GetNativeHandle()));
            int num = 0;

            Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, false, out num);
            if (num == 0)
            {
                return(customAttributes);
            }
            CustomAttributeData[] array = new CustomAttributeData[customAttributes.Count + num];
            customAttributes.CopyTo(array, num);
            for (int i = 0; i < num; i++)
            {
                array[i] = new CustomAttributeData(customAttributes2[i]);
            }
            return(Array.AsReadOnly <CustomAttributeData>(array));
        }
Esempio n. 30
0
        internal static IList <CustomAttributeData> GetCustomAttributesInternal(RuntimeAssembly target)
        {
            IList <CustomAttributeData> customAttributes1 = CustomAttributeData.GetCustomAttributes((RuntimeModule)target.ManifestModule, RuntimeAssembly.GetToken(target.GetNativeHandle()));
            int count = 0;

            Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, false, out count);
            if (count == 0)
            {
                return(customAttributes1);
            }
            CustomAttributeData[] array = new CustomAttributeData[customAttributes1.Count + count];
            customAttributes1.CopyTo(array, count);
            for (int index = 0; index < count; ++index)
            {
                array[index] = new CustomAttributeData(customAttributes2[index]);
            }
            return((IList <CustomAttributeData>)Array.AsReadOnly <CustomAttributeData>(array));
        }