title: How is memory allocated when you create a property of class?
body: <p>I have the following class: </p>
  
  <pre><code>public class A
  {
      public List&lt;string&gt; AList { get; set; }
  }
  </code></pre>
  
  <p>Then I create object of a class:</p>
  
  <pre><code>A objectA = new A();
  objectA.AList = new List&lt;string&gt;() { "1", "2", "3" };
  </code></pre>
  
  <p>My question is <strong>how memory will be allocated in a heap? I mean will be <code>objectA.AList</code> allocated inside of <code>objectA</code> (image1) or as a separate object in a heap(image2)</strong></p>
  
  <p>Image1:</p>
  
  <p><a href="https://i.stack.imgur.com/M6vIU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M6vIU.png" alt="enter image description here"></a></p>
  
  <p>Image2:</p>
  
  <p><a href="https://i.stack.imgur.com/Zml8k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zml8k.png" alt="enter image description here"></a></p>