Initialize Static Class Members with Static Constructors.
使用静态构造器初始化静态类成员。
Static constructors are called at some point between when the program starts and the class is instantiated.
静态构造函数在程序开始和类实例化之间的某个时刻调用。
Static initializers and static constructors provide the cleanest, clearest way to initialize static members of your class.
静态初始化器和静态构造函数提供了最洁净的、最间接的方式来初始化类的静态成员。
A typical use of static constructors is when the class is using a log file and the constructor is used to write entries to this file.
静态建构函式通常用在当类别使用记录档,而建构函式被用来将项目写入该档案。
A link demand performed on a static class constructor does not protect the constructor because static constructors are called by the system, outside the application's code execution path.
对静态类构造函数执行的链接要求不会保护该构造函数,因为静态构造函数是由系统调用的,它们并不包括在应用程序的代码执行路径中。
Closures can be passed as interface to static methods, constructors.
闭包可以通过接口传递给静态方法和构造函数。
Given an object (such as Foo, defined below), static crosscutting makes it quite simple to create new methods, add additional constructors, and even alter the inheritance hierarchy.
给定一个对象(比如下面定义的Foo),静态横切使得创建新方法、添加附加的构造函数,甚至改变继承层次都变得十分简单。
The other two constructors just turn your file path or Directory object into an IndexReader by calling the static method IndexReader.open .
其他两个构造方法只是调用静态方法IndexReader . open把你的文件路径或Directory对象转换成一个IndexReader。
Static methods can also create the buffers, because no constructors exist.
静态方法也可以创建缓冲区,因为不存在构造函数。
This meant that it lacked many things .NET developers take for granted such as constructors and static methods.
这意味着其中缺少很多.NET开发者认为应该有的内容,像构造函数以及静态方法等。
You should not use your instance constructors, some special private function, or any other idiom to initialize static variables.
不应该使用实例构造函数、一些特殊的私有方法、任何其它习惯来初始化静态变量。
Therefore, you should not rely on class constructors to initialize thread-relative static fields.
因此,您不应依赖于类构造函数来初始化线程相关的静态字段。
Static classes and structs can also have constructors.
静态类别和结构也可以拥有建构函式。
They do not contain constructors, copy assignment operators, destructors, or non-static data members that are not themselves PODS.
这些资料结构不包含建构函式、复制指派运算子,或本身不是PODS的非静态资料成员。
They do not contain constructors, copy assignment operators, destructors, or non-static data members that are not themselves PODS.
这些资料结构不包含建构函式、复制指派运算子,或本身不是PODS的非静态资料成员。
应用推荐