Model binding to Lists throws "Collection is read-only" exception
asp.net-mvc-4, c#, razor
Solution
Your Array was probably working on Insert (Where a new object is created).
The issue happens when you try to update your model.
For me, replacing `string[]` to `List<string>` solved the problem.
//instead of....
public string[] TagsArray { get; set; }
//I now have
public List<string> TagsArray { get; set; }
Problem
I have a class like this: ``` public class SomeModel { public List<Item> Items { get; set; } public SomeModel() { this.Items = new List<Item>(); } } ``` Where there can be a variable amount of `Item`s upon form post, zero to many. I'm using javascript to dynamically append hidden input fields on submit: ``` $("#container").children(".item").each(function (i) { form.append('<input type="hidden" name="Items[' + i + '].Id" value="' + $(this).val() + '" />'); }); ``` However, after submitting, I get this error: ``` System.NotSupportedException: Collection is read-only. ``` The rendered syntax is basically the same as one I would get using `@Html.HiddenFor(model => model.Items[i].Id)` with `model.Items` being an array instead of a list, and that works fine. What is going wrong here? Action Method signature: ``` public ActionResult Post(SomeModel m) { ```