Is there a way in C# or .net IL to force a class that has a type initializer (static constructor) to load itself, without accessing any of its parameters?
Assuming I\'ve
Rummaging in the CLI spec, I found a reference to the method RuntimeHelpers.RunClassConstructor
If a language wishes to provide more rigid behavior — e.g., type initialization automatically triggers execution of base class’s initializers, in a top-to-bottom order — then it can do so by either:
- defining hidden static fields and code in each class constructor that touches the hidden static field of its base class and/or interfaces it implements, or
- by making explicit calls to
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor
(see Partition IV).