c# 静态构造函数调用
静态构造函数在使用静态成员的时候调用。但是这个例子没有先调用静态构造函数。想知道为什么
回答:
Straight from ECMA-334:
17.4.5.1: "If a static constructor (§17.11) exists in the class, execution of the static field initializers occurs immediately prior to executing that static constructor. Otherwise, the static field initializers are executed at an implementation-dependent time prior to the first use of a static field of that class."
回答:
这样就可以了 谢谢
以上是 c# 静态构造函数调用 的全部内容, 来源链接: utcz.com/a/120259.html