Dynamically Sorting with LINQ

后端 未结 9 2015
自闭症患者
自闭症患者 2020-12-16 04:57

I have a collection of CLR objects. The class definition for the object has three properties: FirstName, LastName, BirthDate.

I have a string that reflects the name

9条回答
  •  自闭症患者
    2020-12-16 05:53

    you can do this with Linq

    var results = from c in myCollection
        orderby c.SortProperty
        select c;
    

提交回复
热议问题