コード例 #1
0
        static internal List <MrCustomAttribute> GetCustomAttributesFromHandles(
            CustomAttributeHandleCollection customAttributeHandles,
            MrType declaringType)
        {
            var customAttributes = new List <MrCustomAttribute>(customAttributeHandles.Count);

            foreach (var customAttributeHandle in customAttributeHandles)
            {
                var customAttribute = new MrCustomAttribute(customAttributeHandle, declaringType, declaringType.Assembly);
                customAttributes.Add(customAttribute);
            }

            return(customAttributes);
        }
コード例 #2
0
        override public ImmutableArray <MrCustomAttribute> GetCustomAttributes()
        {
            if (IsTypeCode || IsFakeType || IsGenericParameter)
            {
                return(ImmutableArray <MrCustomAttribute> .Empty);
            }

            var customAttributeHandles = this.TypeDefinition.GetCustomAttributes();
            var customAttributes       = new List <MrCustomAttribute>(customAttributeHandles.Count);

            foreach (var customAttributeHandle in customAttributeHandles)
            {
                var customAttribute = new MrCustomAttribute(customAttributeHandle, this, Assembly);
                customAttributes.Add(customAttribute);
            }

            return(customAttributes.ToImmutableArray());
        }