The runtime does not give a type constructor a second chance.
运行库不会给类型构造函数第二次机会。
I suppose you'd call that an idempotent type constructor.
我想你会调用一个幂等类型的构造函数。
You'll need to evaluate the tradeoffs in using an explicit type constructor.
您在使用显式类型构造函数时需要进行权衡。
A runtime thread must acquire this lock before invoking the type constructor.
运行库线程必须在调用类型构造函数之前获得此锁。
As you saw earlier, the code for a static field initializer executes inside an implicit type constructor.
正如您在前面看到的那样,静态字段初始值设定项的代码在隐式类型构造函数的内部执行。
Another behavior unique to type constructors is how the runtime manages exceptions in a type constructor.
类型构造函数的另一个独特行为是运行库管理类型构造函数中的异常的方式。
This program also demonstrates how static field initializers execute before the code inside an explicit type constructor.
此程序还演示了静态字段初始值设定项如何在显式类型构造函数中的代码之前执行。
The second scenario is when a type has a initializer for a static field, in which case the compiler adds a type constructor behind the scenes.
第二种情况是,类型具有一个用于静态字段的初始值设定项,在这种情况下,编译器会在后台添加类型构造函数。
The runtime will stop any exceptions trying to leave a type constructor and wrap the exception inside of a new TypeInitializationException object.
运行库将停止任何尝试保留类型构造函数的异常,并将该异常包装到一个新的TypeInitializationException对象内。
This comes from the Common Language Infrastructure (CLI) spec that guarantees a type constructor will execute only once, unless explicitly invoked by user code.
这种行为是由公共语言架构(Common Language Infrastructure,CLI)规范导致的,该规范确保一个类型构造函数只执行一次,除非用户代码进行显式调用。
Without beforefieldinit, the runtime must run the type constructor at a precise time-just before the first access to static or instance fields and methods of the type.
如果没有beforefieldinit,运行库就必须在某个精确时间运行类型构造函数,即,恰好在第一次访问该类型的静态或实例字段和方法之前。
This flag allows the runtime to execute the type constructor method at any time it chooses, as long as the method executes before the first access to a static field for the type.
此标志使得运行库能够在任何时候执行类型构造函数方法,只要该方法在第一次访问该类型的静态字段之前执行即可。
When an explicit type constructor is present, the compilers will not mark the type with beforefieldinit, and the precise timing restrictions lead to the performance drop hinted at by FxCop.
当存在显式类型构造函数时,编译器不会用beforefieldinit标记该类型,精确的计时限制会导致FxCop所暗示的性能下降。
In the program run shown in Figure 7, the runtime avoided deadlock by allowing Static2 to access the static Message property of Static1 before the type constructor for Static1 finished execution.
在图7所示的程序运行中,运行库通过允许Static2在Static1的类型构造函数完成执行之前访问Static1的静态Message属性,从而避免了死锁。
Thus, by declaring the variables with this type, you can directly assign the result of a constructor call to the corresponding variable.
这样,通过声明这种类型的变量,可以直接把构造函数调用的结果分配给对应的变量。
But you cannot use a type parameter to access a constructor because, at compile time, you don't know what class is being constructed and therefore what constructors are available.
但是您不能使用类型参数访问构造函数,因为在编译的时候还不知道要构造什么类,因此也就不知道使用什么构造函数。
Use assignment context, as in the simple scheme, and also use the type of constructor arguments (call this complex).
使用赋值上下文,如简单架构中那样,还使用构造函数参数的类型(称为复杂结构)。
Constructor injection USES a constructor to determine what type of concrete object to return.
构造函数注入利用构造函数判断要返回的具体对象类型。
The constructor can take a simple built-in numerical type or character data.
该构造函数可以接受简单的内置数值类型或字符数据作为参数。
In Listing 3, the name and content type of the input document is specified by the constructor.
在清单3中,输入文档的名称和内容类型由构造函数指定。
This type actually defines the signature of a constructor for the specified class and a matching sequence of values.
该类型实际定义了指定用于类和值的匹配序列的构造器的签名。
To see this behavior in action, use the patch containing the new constructor, but before applying it, type your own, slightly different, constructor - like the one in Listing 8.
要查看这个行为的实际效果,可以使用含有新构造函数的补丁,但是在应用之前,输入您自己的、稍微有差异的构造函数—如清单8中所示。
This constraint forces any type 't' to have a default constructor, that is, a constructor that takes no parameters.
这个约束强制任何类型'T '都必须具有无参数的公共构造函数。
It can also detect if a constructor function of a schema-type is supported; more about that in a moment.
还可以检查是否支持模式类型的构造器函数,特别是在当时。
An Eclipse SWT GUI, then the type includes, as one of its members, a constructor with one of the following signatures.
如果是EclipseSWTGUI,类型需将具有以下签名之一的构造函数作为其成员包含进来。
On the other hand, the complex algorithm yields Box, because that is the most specific type it can infer using the constructor arguments.
另一方面,复杂算法产生Box,因为这是使用构造函数参数可以推断的最具体类型。
To instantiate a Dictionary object, you need to pass a type string and a DictionaryIO object to its constructor.
要实例化Dictionary对象,需要将类型字符串和DictionaryIO 对象传递给它的构造函数。
First, the program did not hit the catch clause for an exception of type ApplicationException, even though that's the type of exception thrown from the static constructor.
第一,该程序不会为类型是ApplicationException的异常寻找catch子句,即使这种类型的异常是从静态构造函数引发的也如此。
Unfortunately, you can't invoke a generic constructor with a wildcard type argument, even though you know such a constructor exists. However, you can do this.
不幸的是,您不能用通配符类型的参数调用泛型构造函数,即使知道存在这样的构造函数也不行。
Figure 1 shows a constructor with two arguments of type Point and a destructor modeled for the DrawingSurface class of the sample application used here for illustration purposes.
图1展示了为示例应用程序(在这里用于举例)的drawingsurface类建模的带有两个Point类型参数的构造方法和一个析构方法。
应用推荐