This project is read-only.

How do a value type data member reside inside a reference type object

May 23, 2011 at 9:42 AM

struct SomeValueType {
 public Int32 m_x, m_y;


class SomeRefType {
 public SomeValueType m_someValType;


class Program {

   public static void Main(String[] args) {

SomeRefType obj = new SomeRefType();




I am not clear as to how "SomeValueType" is laid out in memory.

My take is that "SomeValueType" is allocated on the managed heap and is resides inside the memory allocated for "obj" on the managed heap. Is this assumption correct?