C# Order by in foreach

后端 未结 3 1587
死守一世寂寞
死守一世寂寞 2021-01-12 08:06

I\'m new to MVC C#.

Here is a ready and working code (the part of the working code).

@foreach (var item in Model)
{            
    
3条回答
  •  隐瞒了意图╮
    2021-01-12 08:32

    Directly use orderby

    @foreach (var item in Model.OrderBy(i => i.Order))
    {            
        
    @Html.Raw(@item.Description)
    }

提交回复
热议问题