См. Раздел II.21 спецификации C # (версия 6), определенной в ECMA-335 :
Custom attributes are declared using the directive .custom, followed by the method
declaration for a type constructor, optionally followed by a Bytes in parentheses:
CustomDecl ::=
Ctor [ ‘=’ ‘(’ Bytes ‘)’ ]
Формат сегмента Bytes
определен в разделе II.23.3:
CustomAttrib starts with a Prolog – an unsigned int16, with value 0x0001.
...
Next is a description of the optional “named” fields and properties. This starts with
NumNamed – an unsigned int16 giving the number of “named” properties or fields that
follow. Note that NumNamed shall always be present. A value of zero indicates that there
are no “named” properties or fields to follow (and of course, in this case, the
CustomAttrib shall end immediately after NumNamed).
Примеры различных пользовательских атрибутов приведены в разделе VI.B.3.
В случае ParamArrayAttribute
первые два байта (01 00
) равны Prolog
(в формате с прямым порядком байтов), а последние два байта (00 00
) равны NumNamed
(0 = нет). аргументы).