How do I order by lastname?

This question already has an answer here:

  • How to Sort a List<T> by a property in the object 19 answers

  • You can use OrderBy for that:

    @foreach (var LedenA in Model.Groepen.AllMembers.OrderBy(x => x.Anaam))
    { }
    

    If you want to sort on the first name after that, use ThenBy :

    @foreach (var LedenA in Model.Groepen.AllMembers.OrderBy(x => x.Anaam).ThenBy(x => x.Vnaam))
    { }
    
    链接地址: http://www.djcxy.com/p/70946.html

    上一篇: 如何对列表进行排序<T>?

    下一篇: 我如何按姓氏排序?