What does “highlighted string in structure” mean for type values?

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”?

Update

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).

+3
source share
2 answers

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.

+2

- , . Point foo; int Point_X; int Point_Y;. foo = bar;, Point, foo_X = bar_X; foo_Y = bar_Y;. ( ) .

- , , , :

  • `byref`, ( , ),
  • struct , `Point foo [];` `int foo_X []; int foo_Y []; `. , .
  • , , .

. P Q , (P Q). : , , P Q.

0
source

All Articles