title: Passing objects by reference vs value
body: <p>I just want to check my understanding of C#'s ways of handling things, before I delve too deeply into designing my classes. My current understanding is that:</p>
  
  <ul>
  <li><code>Struct</code> is a <em>value</em> type, meaning it actually contains the data members defined within.</li>
  <li><p><code>Class</code> is a <em>reference</em> type, meaning it contains references to the data members defined within.</p></li>
  <li><p>A method signature passes parameters by <em>value</em>, which means a copy of the value is passed to the inside of the method, making it expensive for large arrays and data structures.</p></li>
  <li>A method signature that defines a parameter with the <strong>ref</strong> or <strong>out</strong> keywords will instead pass a parameter by <em>reference</em>, which means a pointer to the object is provided instead.</li>
  </ul>
  
  <p>What I don't understand is what happens when I invoke a method, what actually happens. Does new() get invoked? Does it just automagically copy the data? Or does it actually just point to the original object? And how does using <strong>ref</strong> and <strong>out</strong> affect this?</p>