本文介绍了单是否支持"模块的初始化"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只是好奇,如果单有对模块的初始化的支持? blogs.msdn/b/junfeng /archive/2005/11/19/494914.aspx
Just curious if mono has support for "Module Initializers"? blogs.msdn/b/junfeng/archive/2005/11/19/494914.aspx
推荐答案是的。
我不知道IL,但我在C#
I don't know IL, but I wrote this in C#
using System; public class Program { public static void Main(string[] args) { Console.WriteLine("Main"); } }
然后我用monodis产生IL文件,我说这code中的.module MAIN.EXE行之后。
I then used monodis to generate the il file and I added this code after the .module main.exe line.
.method assembly specialname rtspecialname static void .cctor() cil managed { .maxstack 8 IL_0000: ldstr "module method" IL_0005: call void class [mscorlib]System.Console::WriteLine(string) IL_000a: ret }和当它运行时,我得到的输出的预期。
And when it runs I get the output expected.
module method Main
无论ILASM和运行支持。
Both ilasm and the runtime supports it.
更多推荐
单是否支持"模块的初始化"?
发布评论