What is the earliest entrypoint that the CLR calls before calling any method in an assembly?
- 阅读更多 关于 What is the earliest entrypoint that the CLR calls before calling any method in an assembly?
问题 In the past years I've occasionally been wondering what equivalent of the (in)famous DLL_PROCESS_ATTACH was available in the .NET world. Any documentation I have says, slightly simplified, that the earliest entry point to a class is the static constructor (cctor), but you cannot influence when it is called, nor can you define one cctor that's guaranteed to be called prior to any other cctor or field initializer, hack, it may not even be called at all if the class is never used. So, if you