title: Why I need to use ref keyword in both declaration and Call?
body: <p>Duplicate of: <a href="https://stackoverflow.com/questions/1393946/what-is-the-purpose-of-the-out-keyword-at-the-caller-in-c/1393956#1393956">What is the purpose of the “out” keyword at the caller?</a>  </p>
  
  <p><strong>Why</strong> I need to use <strong>'ref'</strong> keyword in both declaration and Call.</p>
  
  <pre><code>void foo(ref int i)
  {
  
  }
  </code></pre>
  
  <p>For example, Consider above function. If I will call it without ref keyword as </p>
  
  <pre><code>foo(k);
  </code></pre>
  
  <p>it will give me error : </p>
  
  <blockquote>
    <p>Argument '1' must be passed with the
    'ref' keyword</p>
  </blockquote>
  
  <p><strong>Why</strong> isn't it enough to just specify in the method signature only ?</p>