W
Wiktor Zychla
Hello,
for some reason I need to use attributes in ILAsm code and read these
attributes in C# code. My problem is with the attribute declaration inside
ILAsm code. I know that I define any attribute by using ILasm's ".custom"
keyword but I do not understand how to initialize the attribute Value blob
when the attribute contains some fields. I just do not understand that
binary format:
..custom instance void MyAttribute::.ctor(bool) = (01 00 01 00 00)
(example taken from "Inside IL" by Serge Lidin, the attribute constructor
has only 1 parameter of type 'bool')
Lidin does not say anything on how the attrubute's constructor arguments
should be encoded (except of arguments of type 'string', he says that such
attributes should be represented by unicode hex data).
My questions:
- how do I encode any particular datatype (strings, ints, etc)?
- how do I encode attributes of custom types?
- how do I separate consecutive arguments in the argument list?
Thanks for any help,
Wiktor Zychla
for some reason I need to use attributes in ILAsm code and read these
attributes in C# code. My problem is with the attribute declaration inside
ILAsm code. I know that I define any attribute by using ILasm's ".custom"
keyword but I do not understand how to initialize the attribute Value blob
when the attribute contains some fields. I just do not understand that
binary format:
..custom instance void MyAttribute::.ctor(bool) = (01 00 01 00 00)
(example taken from "Inside IL" by Serge Lidin, the attribute constructor
has only 1 parameter of type 'bool')
Lidin does not say anything on how the attrubute's constructor arguments
should be encoded (except of arguments of type 'string', he says that such
attributes should be represented by unicode hex data).
My questions:
- how do I encode any particular datatype (strings, ints, etc)?
- how do I encode attributes of custom types?
- how do I separate consecutive arguments in the argument list?
Thanks for any help,
Wiktor Zychla