Sort one list by another

前端 未结 7 1414
借酒劲吻你
借酒劲吻你 2020-12-02 05:59

I have 2 list objects, one is just a list of ints, the other is a list of objects but the objects has an ID property.

What i want to do is sort the list of objects b

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 06:32

    Another LINQ-approach:

     var orderedByIDList = from i in ids 
                           join o in objectsWithIDs
                           on i equals o.ID
                           select o;
    

提交回复
热议问题