How can I run a static constructor?

前端 未结 10 1332
面向向阳花
面向向阳花 2020-12-08 02:15

I\'d like to execute the static constructor of a class (i.e. I want to \"load\" the class) without creating an instance. How do I do that?

Bonus question: Are there

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 02:39

    The static constructor runs automatically the first time you access the class. There is no need (or capability) to 'run' it yourself.

提交回复
热议问题