In this article, you've seen some performance consequences when a class has a static constructor.
在本文中,您已经看到了在类具有一个静态构造函数时所导致的性能结果。
A static constructor is modeled by setting the static property of the corresponding UML operation.
通过给相应的UML操作设置static属性来对static constructor建模。
The rule description tells you that an explicit static constructor results in code that performs worse.
该规则说明告诉您,显式静态构造函数会导致代码性能变差。
A static constructor cannot be called directly.
无法直接调用静态构造函数。
The user has no control over when the static constructor is called.
用户不能控制何时调用该静态构造函数。
To fix the second kind, add a private static constructor to your type.
要修复第二类冲突,请向您的类型中添加私有静态构造函数。
Always provide a static constructor when providing static member variables.
当提供静态成员变量时,总是提供一个静态构造函数。
The user has no control on when the static constructor is executed in the program.
使用者无法控制程序中静态建构函式执行的时间。
A static constructor, also known as a class constructor, is used to initialize a type.
静态构造函数(也称为类构造函数)用于初始化类型。
If a static constructor is not private, it can be called by code other than the system.
如果静态构造函数不是私有,则系统以外的代码可以调用它。
A managed class cannot have a static constructor that also has a member initialization list.
托管类中不能有本身有成员初始化列表的静态构造函数。
When you have more complicated logic to initialize static member variables, create a static constructor.
当你有更复杂的逻辑来初始化静态成员变量时,请创建静态构造函数。
The programming language compiler added a default static constructor to your type and did not make it private.
编程语言编译器已向您的类型中添加默认静态构造函数,但未将其设置为私有。
As with instance initialization, you can use the initializer syntax as an alternative to the static constructor.
和实例初始化一样,可以使用初始化器语法作为静态构造函数的变体。
The system calls the static constructor before the first instance of the type is created or any static members are referenced.
系统在创建第一个类型实例或引用任何静态成员之前调用静态构造函数。
If you want your derived class to set this property, you should do so within the static constructor or in other initialization routines.
如果您希望派生类设置此属性,则应该在静态构造函数或其他初始化例程中完成此工作。
A static constructor is a special function that executes before any other methods, variables, or properties defined in that class are accessed.
静态构造函数是一个特殊的方法,它在类中任何其它方法、变量或者属性被访问之前被执行。
A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced.
在建立第一个执行个体或参考任何静态成员之前,就会自动呼叫静态建构函式以初始化类别。
Static members are initialized before the static member is accessed for the first time and before the static constructor, if there is one, is called.
静态成员会在第一次受到存取前,以及静态建构函式(如果有)受到呼叫之前进行初始化。
If your software design requires an explicit call to a static constructor, it is likely that the design contains serious flaws and should be reviewed.
如果软件设计要求显式调用静态构造函数,则可能该设计存在严重缺陷,请检查该设计。
If your software design requires an explicit call to a static constructor, it is likely that the design contains serious flaws and should be reviewed.
如果软件设计要求显式调用静态构造函数,则可能该设计存在严重缺陷,请检查该设计。
应用推荐