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 got the class
public static class LogInitialization {
static LogInitialization() {
System.Console.WriteLine("Initialized");
}
}
Is there a way to get this line to print?
Note that the class is static so I can't instantiate it to force initialization, and it has no public members so I can't access them to start it.
TypeHandle
property on your instance ofType
. – Quash