title: C# Recursive Function with Optional Parameter
body: <p>I'm having issues with <code>optional parameters</code> on <code>recursive functions</code></p>
  
  <p>Here is a sample code:</p>
  
  <pre><code>private static void RecursiveFunction(int x, int optional = 0)
  {
      if (x &lt; 5)
          RecursiveFunction(x + 1, optional++);
  }
  </code></pre>
  
  <p>When invoking the function:</p>
  
  <pre><code>RecursiveFunction(0);
  </code></pre>
  
  <p>I've got the following results (just calling this code <code>string.Format("{0} - {1}", x, optional)</code> in the immediate window):</p>
  
  <pre><code>"0 - 0"
  "1 - 0"
  "2 - 0"
  "3 - 0"
  "4 - 0"
  </code></pre>
  
  <p>Am I missing anything here? Thanks!</p>