单是否支持"模块的初始化"? [英] Does Mono support "Module Initializers"?

查看:97
本文介绍了单是否支持"模块的初始化"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是好奇,如果单有对模块的初始化的支持? http://blogs.msdn.com/b/junfeng /archive/2005/11/19/494914.aspx

Just curious if mono has support for "Module Initializers"? http://blogs.msdn.com/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.

这篇关于单是否支持"模块的初始化"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆