Quantcast
Channel: The Chronicles of Nojo
Viewing all articles
Browse latest Browse all 49

CIL Constant Literals

$
0
0
Sometimes you'll want to create constant literals in CIL code. Most of the time you won't, but when you do, you'll need this. There are multiple ways of representing a constant, such as a constructor argument to a custom attribute, and ildasm.exe will give you something like this:
= ( DE AD BE EF )
If you want to re-write it, you know the signature (it's right next to the literal in the .il file,) so you only need to replace the single encoded binary literal into one like this:
= { string('Hello, World!') bool(true) type(int32) type([System.Xml]System.Xml.XmlDocument) }

Viewing all articles
Browse latest Browse all 49

Trending Articles