title: What is the use of "ref" for reference-type variables in C#?
body: <p>I understand that if I pass a value-type (<code>int</code>, <code>struct</code>, etc.) as a parameter (without the <code>ref</code> keyword), a copy of that variable is passed to the method, but if I use the <code>ref</code> keyword a reference to that variable is passed, not a new one.</p>
  
  <p>But with reference-types, like classes, even without the <code>ref</code> keyword, a reference is passed to the method, not a copy. So what is the use of the <code>ref</code> keyword with reference-types?</p>
  
  <hr>
  
  <p>Take for example:</p>
  
  <pre><code>var x = new Foo();
  </code></pre>
  
  <p>What is the difference between the following?</p>
  
  <pre><code>void Bar(Foo y) {
      y.Name = "2";
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>void Bar(ref Foo y) {
      y.Name = "2";
  }
  </code></pre>