How can I find a static class initializer in C# using reflection? Even GetMembers()
invoked on the type of a class does not seem to provide that information.
使用type.TypeInitializer
进行查找。
I found a way to call static constructor by using reflection. Is this what you are looking for.
Type myClass = typeof (MyClass); myClass.TypeInitializer.Invoke(null,null);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.