In ASP.NET MVC 2, you can use this URL and this controller method:
GET http://server/controller/get?id=5
public ActionResult Get(int id)
{
...
}
And the ModelBinder will convert the id=5
querystring to id = (int) 5
in the method parameter. However, this won't work:
GET http://server/controller/get?idlist=1,2,3,4,5
public ActionResult Get(int[] idlist)
{
...
}
idlist
will be null in the parameter. Although the parsing for this is pretty trivial, I was wondering if there is a way to either change the method signature or the querystring in order to make the default ModelBinder automatically deserialize arrays/collections?