Check out the module initializer addon of the awesome opensource IL-Weaver project "fody", written by Simon Cropp: https://github.com/fody/moduleinit
It allows you to specify a method which will be translated into an assembly initializer by fody:
public static class ModuleInitializer
{
public static void Initialize()
{
//Init code
}
}
gets this:
static <Module>()
{
ModuleInitializer.Initialize();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…