When I used the params keyword for a parameter I found this line in the IL. What I understood from this is that a constructor of the ParamArrayAttribute class is called but I didn't understand what 01 00 00 00 means.
.custom instance void [mscorlib]System.ParamArrayAttribute::.ctor() = (
01 00 00 00
)
When used to decorate members, attributes may contain initialization parameters that will be sent to the attribute's constructor.
For Instance
is compiled to
The byte code sequence you see corresponds to the initialization of the
EmitDefaultValue
parameter.In your case,
is the sequence of bytes used when no parameters are passed to the attribute contructor.
Please refer to section II.21 of the C# specification (version 6) defined in ECMA-335:
The format of the
Bytes
segment is defined in section II.23.3:Examples of various custom attributes are provided in section VI.B.3.
In the case of
ParamArrayAttribute
, the first two bytes (01 00
) areProlog
(in little-endian format), and the last two bytes (00 00
) areNumNamed
(0 = no arguments).