赋值转换将一个常数值设置到目标属性。
An assign transform sets a constant value to a target attribute.
图11显示了一个赋值转换,它将Person的prefix属性设置为空。
Figure 11 shows an assign transform that sets the prefix attribute of Person to null.
例如,如果您有一个希望赋值给许多目标的值,您可以使用赋值来将某个值设置到该变量,然后使用从该变量到多个属性的移动转换。
For example, if you have a value that you want to assign to many targets, you can use an assign to set a value to the variable, then use a move transform from that variable to multiple attributes.
这会导致其他操作数也被转换成64位的类型,这样在对表达式进行赋值时就不需要再进行转换了。
This will cause the other operands to be promoted to 64-bits and no further conversion is needed when the expression is assigned.
在更新模型值的阶段中,会使用保存在GUI组件中的经过转换和有效性验证的值来调用CD的赋值方法。
In the update model values phase, the setter methods on the CD are invoked with the converted and validated values stored in the GUI components.
另外一种解决方案是对整个表达式进行转换,这样就可以在赋值时进行符号扩展。
Another solution is to cast the entire expression such that sign extension occurs on assignment. For example, consider the problem caused by the following.
如果在表达式中混合使用无符号和有符号的32位整数,并将其赋值给一个有符号的long类型,那么将其中一个操作数转换成64位的类型。
In cases where unsigned and signed 32-bit integers are mixed in an expression and assigned to a signed long, cast one of the operands to its 64-bit type.
赋值、计算或数据类型转换的结果太大,以至于不能在那种类型变量允许的取值范围内表示。
The result of an assignment, calculation, or data type conversion is too large to be represented within the range of values allowed for that type of variable.
这意味着你可以直接在返回的对象上访问成员,或者可以使用强类型的局部变量为其赋值,而无需进行转换。
This means that you can easily access members directly off a returned object, or you can assign it to a strongly typed local variable without having to cast.
不过,可为类型定义隐式转换运算符,这样就可以对这些类型使用赋值运算符。
However, you can define implicit conversion operators for a type, which enable you to use the assignment operator with those types.
如果编译环境强制使用严格的语义,则此赋值运算符将隐式地执行扩大转换而不是收缩转换。
This assignment operator implicitly performs widening but not narrowing conversions if the compilation environment enforces strict semantics.
当需要将一个较大的算术类型赋值给较小的类型时,使用强制转换非常有用。
Such casts are useful when assigning a larger arithmetic type to a smaller type.
当需要将一个较大的算术类型赋值给较小的类型时,使用强制转换非常有用。
Such casts are useful when assigning a larger arithmetic type to a smaller type.
应用推荐