The MSDN says: " Value types are allocated on the stack or on the line. "
Does “highlighted line” mean that a value type can be assigned immediately after it is declared? Say, is it declared on the heap, then it stands out in the next slot of the heap?
Then why does he say “in structure”?
if “structure” specifically means “structure”, why doesn't it say anything about “class”? like a field in Class, it is not on the stack, nor is it inline in struct(it is inline in Class).
Class
struct
inline , .
:
http://msdn.microsoft.com/en-us/library/system.valuetype.aspx
, , .
struct Inner { public int A; } struct Outer { public Inner I; public int B; } Outer o = new Outer(); o.I = new Inner();
I , Outer.
I
Outer
- , . Point foo; int Point_X; int Point_Y;. foo = bar;, Point, foo_X = bar_X; foo_Y = bar_Y;. ( ) .
Point foo;
int Point_X; int Point_Y;
foo = bar;
Point
foo_X = bar_X; foo_Y = bar_Y;
- , , , :
. P Q , (P Q). : , , P Q.