Free mag vol1 | Page 714

CHAPTER 18  UNDERSTANDING CIL AND THE ROLE OF DYNAMIC ASSEMBLIES } } Save your file to a convenient location (for example, C:\RoundTrip) and compile your program using csc.exe, like so: csc HelloProgram.cs Now, open HelloProgram.exe with ildasm.exe and, using the File Dump menu option, save the raw CIL code to a new *.il file (HelloProgram.il) in the same folder containing your compiled assembly (all of the default values of the resulting dialog box are fine as is).  Note ildasm.exe will also generate a *.res file when dumping the contents of an assembly to file. These resource files can be ignored (and deleted) throughout this chapter, as you will not be making use of them. Now you are able to view HelloProgram.il using your text editor of choice. Here is the (slightly reformatted and annotated) result: // Referenced assemblies. .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 } // Our assembly. .assembly HelloProgram { /**** TargetFrameworkAttribute data removed for clarity! ****/ .hash algorithm 0x00008004 .ver 0:0:0:0 } .module HelloProgram.exe .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 .corflags 0x00000003 // Definition of Program class. .class private auto ansi beforefieldinit Program extends [mscorlib]System.Object { .method private hidebysig static void Main(string[] args) cil managed { // Marks this method as the entry point of the // executable. 657