title: Reference types live on the heap, value types live on the stack
body: <p>While reading &quot;C# in Depth&quot; I was going through the section titled &quot;Reference types live on the heap, value types live on the stack.&quot;</p>
  <p>Now what I could understand is (mainly for ref type):</p>
  <pre><code>class Program
  {
      int a = 5;  // stored in heap
  
      public void Add(int x, int y) // x,y stored in stack
      {
          int c = x + y;  // c  stored in stack
      }
  }
  </code></pre>
  <p>Just want to clarify if my assumptions are right. Thanks.</p>
  <p>EDIT:
  I should have used diff variables, as I think what I had initially created confusion. So I have modified the code.</p>
  <p>EDIT:
  Yes, as Jon mentioned - <strong>it's a myth</strong>. I should have mentioned that. My apologies.</p>