I have an action that depends on a list of integers. My first instinct was to simply declare the action with a List.
I tried declaring the action in the controller
Yes. The default model binder can bind "ids" to any ICollection. But you have to submit multiple parameters with the same name. That eliminates using the helper method "ActionLink". You can use url helper Action and append the ids to the link like so:
<a href="<%= Url.Action("CreateMultiple")%>?ids=2&ids=1&ids=3">Test link</a>
Here's the link from Haack's block.
I dont think
new List<int> {2, 2, 2}
gets properly converted into an POST that is bindable, you want to send
Ids=1&Ids=2&Ids=3
a comma separate list may also work, im not sure, i don't use the crappy default modelbinder.
Why are you doing that anyway? I hope thats pseudocode for something else...