System.Reflection.CustomAttributeData.GetCustomAttributes C# (CSharp) Method

GetCustomAttributes() public static method

public static GetCustomAttributes ( ParameterInfo target ) : IList
target ParameterInfo
return IList
        public static IList<CustomAttributeData> GetCustomAttributes(ParameterInfo target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            IList<CustomAttributeData> cad = GetCustomAttributes(target.Member.Module, target.MetadataToken);
            
            int pcaCount = 0;
            Attribute[] a = PseudoCustomAttribute.GetCustomAttributes((ParameterInfo)target, typeof(object), out pcaCount);

            if (pcaCount == 0)
                return cad;

            CustomAttributeData[] pca = new CustomAttributeData[cad.Count + pcaCount];
            cad.CopyTo(pca, pcaCount);
            for (int i = 0; i < pcaCount; i++)
                pca[i] = new CustomAttributeData(a[i]);

            return Array.AsReadOnly(pca);
        }
        #endregion

Same methods

CustomAttributeData::GetCustomAttributes ( Assembly target ) : IList
CustomAttributeData::GetCustomAttributes ( MemberInfo target ) : IList
CustomAttributeData::GetCustomAttributes ( Module target ) : IList
CustomAttributeData::GetCustomAttributes ( Module module, int tkTarget ) : IList

Usage Example

Esempio n. 1
0
 public override IList <CustomAttributeData> GetCustomAttributesData()
 {
     return(CustomAttributeData.GetCustomAttributes(this));
 }
All Usage Examples Of System.Reflection.CustomAttributeData::GetCustomAttributes