IL 二校汇总
2008-12-25 01:43
148 查看
When we declare a value type variable, we create a data structure. When we box this variable, an object (a class instance) is created whose data part is an exact bit copy of the data structure. Then we can deal with this instance the same way we would deal with an ordinary object—for example, we could use it in a call to a method, which takes an object reference as a
parameter. It is important to understand that the “original” instance of a value type does not go anywhere after it has been boxed. Its copy does. And what happens to this copy is not reflected back to the original instance of the value type. This effect is known as a problem of mutability of the boxed value types. It is up to the author of the code to propagate possible
changes inflicted upon the boxed instance of the value type back to the original instance.
当声明一个值类型变量时,就创建了一个数据结构。当对这个变量进行装箱时,就会创建一个对象(一个类的引用),它的数据部分就是这个数据结构的准确的逐位复制(bit copy)。然后,可以像处理普通对象那样处理该实例——例如,可以使用实例的调用方法,它会接收一个对象引用作为参数。装箱操作后值类型的“原始”实例不能任意移动,理解这点是非常重要的。它的副本是可以移动的。它的副本无论发生了什么改变都不会反过来影响值类型的“原始”实例。这种效果称为已装箱类型的不稳定性。代码的作者有必要传播可能的改动会影响到值类型的已装箱实例。由值类型的装箱实例造成的改变不会反过来影响值类型的“原始”实例
parameter. It is important to understand that the “original” instance of a value type does not go anywhere after it has been boxed. Its copy does. And what happens to this copy is not reflected back to the original instance of the value type. This effect is known as a problem of mutability of the boxed value types. It is up to the author of the code to propagate possible
changes inflicted upon the boxed instance of the value type back to the original instance.
当声明一个值类型变量时,就创建了一个数据结构。当对这个变量进行装箱时,就会创建一个对象(一个类的引用),它的数据部分就是这个数据结构的准确的逐位复制(bit copy)。然后,可以像处理普通对象那样处理该实例——例如,可以使用实例的调用方法,它会接收一个对象引用作为参数。装箱操作后值类型的“原始”实例不能任意移动,理解这点是非常重要的。它的副本是可以移动的。它的副本无论发生了什么改变都不会反过来影响值类型的“原始”实例。这种效果称为已装箱类型的不稳定性。代码的作者有必要传播可能的改动会影响到值类型的已装箱实例。由值类型的装箱实例造成的改变不会反过来影响值类型的“原始”实例
相关文章推荐
- IL指令汇总
- IL中文资料汇总
- IL指令汇总
- IL指令汇总
- asp.net按钮 button的onclick事件 与oncommand 事件的区别 汇总
- ExtJS的使用方法汇总7——数据存储与传输
- Win10预览版9879更新内容新变化汇总(最新)
- C语言面试题大汇总之华为面试题
- RAD Studio 10 自带Demo代码汇总说明
- JS在IE和FireFox之间的区别汇总
- 有关linux信号汇总
- struts,hibernate,spring配置时问题汇总及解决办法
- javaweb常见易错问题大汇总
- 面试常见问题汇总
- 一个计算机专业学生几年的Java编程经验汇总
- 80个Python经典资料(教程+源码+工具)汇总——下载目录 ...
- 跟我学SpringMVC目录汇总贴、PDF下载、源码下载
- Android Http请求方法汇总
- HTML之标签基础汇总
- 3D专业名词解释大汇总