Modelbinding IEnumerable in ASP.NET MVC POST?

前端 未结 2 1944
后悔当初
后悔当初 2021-02-20 12:46

Is there any issues with modelbinding IEnumerable types to an MVC POST?

Some properties in my Model are not being bound upon a post to an action. Seems that properties o

2条回答
  •  粉色の甜心
    2021-02-20 13:18

    It works fine with the IEnumarble type.
    I think the problem is the ToArray you are writing inside the For loop. (It's very not efficient either)
    change the for loop to foreach.

    See this excellent answer how to achieve it.

提交回复
热议问题