I’ve couple of action methods with parameters of IList type.
public ActionResult GetGridData(IList<string> coll)
{
}
The default behavior is when no data are passed to action method the parameter is null.
Is there any way to get an empty collection rather then null application wide ?
Well, you could either do this:
Or you would need to implement a ModelBinder that will create an empty list instead of returning null. E.g.:
And wired up as:
I’d probably stick with the argument check though…