dimanche 4 juillet 2021

How to check if a C# type was statically constructed

I'm writing a diagnostic tool to examine all domain types across all loaded assemblies. As a part of diagnostics I need to check static fields of the types. So, there is a problem when some class was never accessed before and I request a value of some of its static fields using reflection then static construction of the class happens. I would like to check in some way if the class was statically constructed already and if not to skip it.





Aucun commentaire:

Enregistrer un commentaire