// "i" and "p" popped off the stack here!
Value Types, References Types, and the Assignment Operator
When you assign one value type to another, a member-by-member copy of the field data is
achieved. In the case of a simple data type such as System.Int32, the only member to copy is the
numerical value. However, in the case of our Point, the X and Y values are copied into the new
structure variable. To illustrate, create a new Console Application project named
ValueAndReferenceTypes and copy your previous Point definition into your new namespace.
Now, add the following method to your Program type:
C H A P T E R 4
■
C O R E C # P R O G R A M M I N G C O N S T R U C T S, PA RT I I
129
8849CH04.qxd 10/1/07 10:31 AM Page 129
Do'stlaringiz bilan baham: |