title: Binding arrays in ASP.NET MVC without index?
body: <p>I have an HTML that looks like this:</p>
  
  <pre><code>&lt;input type="text" name="data[]" value="George"/&gt;
  &lt;input type="text" name="data[]" value="John"/&gt;
  &lt;input type="text" name="data[]" value="Paul"/&gt;
  &lt;input type="text" name="data[]" value="Ringo"/&gt;
  </code></pre>
  
  <p>In PHP, I can receive this array like:</p>
  
  <pre><code>$array = $_POST['name'];
  // $array[0] == "George"
  </code></pre>
  
  <p>In ASP.NET MVC the model binder conventions forces me to put indexes in the HTML, so the controller can receive the array.</p>
  
  <pre><code>&lt;!-- HTML for the ASP.NET MVC Version --&gt;
  &lt;input type="text" name="data[0]" value="George"/&gt;
  &lt;input type="text" name="data[1]" value="John"/&gt;
  &lt;input type="text" name="data[2]" value="Paul"/&gt;
  &lt;input type="text" name="data[3]" value="Ringo"/&gt;
  
  // C# Controller
  public ActionResult SomeAction(string[] data)
  {
      // Do stuff
  }
  </code></pre>
  
  <p>If I send the first HTML, data will be <code>null</code> in the Action.</p>
  
  <p>Well, I think this sucks. </p>
  
  <p>If I use client side code to remove or add items to the array, I have to write code to re-index the HTML array.</p>
  
  <p>Is there a way to extend the ASP.NET MVC ModelBinder for binding arrays with no indexes or a workaround to deal with this?</p>
  
  <h2>EDIT</h2>
  
  <p>After trying your answers I arrive to the conclusion that the example I've posted is not useful to my purposes. My real situation is this:</p>
  
  <h2>View</h2>
  
  <pre><code>&lt;table&gt;
  @for (var i = 0; i &lt; Model.Sections.Count; ++i)
  {
      &lt;tr&gt;
          &lt;td&gt;&lt;a href="#" class="edit-section"&gt;&lt;span class="glyphicon glyphicon-question-sign"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;@Html.TextBoxFor(m =&gt; Model.Sections[i].SectionOrder, new { @class = "form-control" })&lt;/td&gt;
          &lt;td&gt;@Html.TextBoxFor(m =&gt; Model.Sections[i].Title, new { @class = "form-control" })&lt;/td&gt;
          &lt;td&gt;@Html.TextBoxFor(m =&gt; Model.Sections[i].SubTitle, new { @class = "form-control" })&lt;/td&gt;
          &lt;td&gt;
              @Html.HiddenFor(m =&gt; Model.Sections[i].Id)
              &lt;a href="#" class="delete-section"&gt;&lt;span class="glyphicon glyphicon-remove"&gt;&lt;/span&gt;&lt;/a&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  &lt;/table&gt;
  </code></pre>
  
  <h2>Action</h2>
  
  <pre><code>public ActionResult SaveSections(ICollection&lt;SectionModel&gt; sections)
  {
      // DO STUFF
  }
  </code></pre>
  
  <p>I've tried making the HTML inputs by hand, like:</p>
  
  <pre><code>@for (var i = 0; i &lt; Model.Sections.Count; ++i)
  {
      &lt;tr&gt;
          &lt;td&gt;&lt;a href="#" class="edit-section"&gt;&lt;span class="glyphicon glyphicon-question-sign"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;@Html.TextBox("Sections.SectionOrder", Model.Sections[i].SectionOrder, new { @class = "form-control" })&lt;/td&gt;
          &lt;td&gt;@Html.TextBox("Sections.Title", Model.Sections[i].Title, new { @class = "form-control" })&lt;/td&gt;
          &lt;td&gt;@Html.TextBox("Sections.SubTitle", Model.Sections[i].SubTitle, new { @class = "form-control" })&lt;/td&gt;
          &lt;td&gt;
              @Html.Hidden("Sections.SubTitle", Model.Sections[i].Id)
              &lt;a href="#" class="delete-section"&gt;&lt;span class="glyphicon glyphicon-remove"&gt;&lt;/span&gt;&lt;/a&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  </code></pre>
  
  <p>But it didn't work...</p>