EnumCustomAttributesCount() public method

public EnumCustomAttributesCount ( int mdToken ) : int
mdToken int
return int
Beispiel #1
0
        internal static unsafe CustomAttributeRecord[] GetCustomAttributeRecords(RuntimeModule module, int targetToken)
        {
            MetadataImport metadataImport = module.MetadataImport;
            int            count          = metadataImport.EnumCustomAttributesCount(targetToken);
            int *          result         = (int *)stackalloc byte[(((IntPtr)count) * 4)];

            metadataImport.EnumCustomAttributes(targetToken, result, count);
            CustomAttributeRecord[] recordArray = new CustomAttributeRecord[count];
            for (int i = 0; i < count; i++)
            {
                metadataImport.GetCustomAttributeProps(result[i], out recordArray[i].tkCtor.Value, out recordArray[i].blob);
            }
            return(recordArray);
        }