title: How does MVC 4 List Model Binding work?
body: <p>If I want a set of inputs in a form to bind to a <code>List</code> in MVC 4, I know that the following naming convention for <code>input</code> <code>name</code> attributes will work:</p>
  
  <pre><code>&lt;input name="[0].Id" type="text" /&gt;
  &lt;input name="[1].Id" type="text" /&gt;
  &lt;input name="[2].Id" type="text" /&gt;
  </code></pre>
  
  <p>But I am curious about how forgiving the model binder is.  For example, what about the following:</p>
  
  <pre><code>&lt;input name="[0].Id" type="text" /&gt;
  &lt;input name="[3].Id" type="text" /&gt;
  &lt;input name="[8].Id" type="text" /&gt;
  </code></pre>
  
  <p>How would the model binder handle this?  Would it bind to a <code>List</code> of length 9 with nulls?  Or would it still bind to a <code>List</code> of length 3? Or would it choke altogether?</p>
  
  <p><strong>Why I care</strong></p>
  
  <p>I want to implement a dynamic form in which the user may add rows to the form, and also may delete rows from the form.  So if I a user deletes row 2 out of 8 total rows, I want to know if I'll need to renumber all of the subsequent inputs.</p>