title: Passing an array to an MVC controller
body: <p>I would like to pass an array of IDs to a controller. Originally I was adding each ID in the query string like so: </p>
  
  <p><a href="http://localhost:4000/customers/active?customerId=1&amp;customerId=2&amp;customerId=3" rel="nofollow noreferrer">http://localhost:4000/customers/active?customerId=1&amp;customerId=2&amp;customerId=3</a></p>
  
  <p>Then on the controller side I had a method that would accept the array like this:</p>
  
  <pre><code>GetCustomers([FromQuery] int[] ids)
  {
     ...
  }
  </code></pre>
  
  <p>This was working well but there are a few situations where there are so many <code>customerIds</code> in the array that the query string became too long so I had to modify the way that the query was being passed to this:</p>
  
  <p><a href="http://localhost:4000/customers/active?customerIds=1,2,3" rel="nofollow noreferrer">http://localhost:4000/customers/active?customerIds=1,2,3</a></p>
  
  <p>I got the solution working by changing <code>GetCustomers</code> params to accept a string instead of an int array and then parsed the <code>customerIds</code> out in the controller (using <code>.Split(',')</code>)</p>
  
  <p>I feel like it was cleaner to pass an array directly instead of having to modify the string on the server side. Is there a way to achieve this given the way the <code>customerIds</code> are now being passed?</p>