1. 用记事本编写如下代码
.assembly HelloWorld{} .assembly extern mscorlib{} .class HelloWorld extends [mscorlib]System.Object { .method public static void HelloWorld() { .maxstack 1 ldstr "Hello World" call void [mscorlib]System.Console::WriteLine(string) ret } .method public static void main() { .entrypoint .maxstack 1 call void HelloWorld::HelloWorld() ret } } 2. 将以上代码保存为ilhelloworld.il,然后运行ilasm.exe 将il编译为exe
3. 执行这个exe文件,我们看到输出Hello World