MVC Razor @foreach

后端 未结 5 1722
半阙折子戏
半阙折子戏 2020-11-27 13:13

I heard that having @foreach inside of a view is a no-no. Meaning, the view should not have any logic in it. What is the best practice on where the logic for the @foreach sh

5条回答
  •  暖寄归人
    2020-11-27 13:27

    When people say don't put logic in views, they're usually referring to business logic, not rendering logic. In my humble opinion, I think using @foreach in views is perfectly fine.

提交回复
热议问题