繼續上一篇"C#程序集系列01,用記事本編寫C#,IL代碼,用DOS命令編譯程序集,運行程序",在F盤的as文件夾中已經有了若干程序集。本篇體驗使用記事本查看可執行程序集的IL代碼。
→打開"VS2012開發人員命令提示",輸入如下命令,并按回車
在as文件夾中多了1.txt和1.res這2個文件→輸入如下命令打開1.txt
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020// Metadata version: v4.0.30319.assembly extern mscorlib{.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z/V.4...ver 4:0:0:0}.assembly extern MyClass{.ver 0:0:0:0}.assembly MainClass{.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ).custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows..hash algorithm 0x00008004.ver 0:0:0:0}.module MainClass.exe// MVID: {73BA142E-F5C9-4C2E-8963-DB7213CB466A}.imagebase 0x00400000.file alignment 0x00000200.stackreserve 0x00100000.subsystem 0x0003 // WINDOWS_CUI.corflags 0x00000001 // ILONLY// Image base: 0x00560000// =============== CLASS MEMBERS DECLARATION ===================.class PRivate auto ansi beforefieldinit MainClassextends [mscorlib]System.Object{.method private hidebysig static void Main() cil managed{.entrypoint// 代碼大小 8 (0x8).maxstack 8
新聞熱點
疑難解答