Just curious if mono has support for "Module Initializers"? http://blogs.msdn.com/b/junfeng/archive/2005/11/19/494914.aspx
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes.
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");
}
}
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
Both ilasm and the runtime supports it.