score:9
Accepted answer
Try this:
List<Person> SortedList = people.OrderBy(o => o.Age).ToList();
score:8
people.Sort((p1, p2) =>
{
return p1.Age - p2.Age;
});
Source: stackoverflow.com
Related Articles
- How to sort class list by integer property?
- Sort List of parent class by property of subclass using LINQ
- Sort a List by a property and then by another
- C#: sort list of objects by DateTime property that is nullable
- How to get list for a property of a class from its collection
- Sort a list based on another list followed by a property on itself with LINQ
- VB.Net Sort a List using property name
- Sort a string property like Integer LINQ
- Get those elements from a List of custom class objects whose one property value is parseable to double
- Sort List<T> by count of property of inner list
- How can I create list of nested classes where a certain property of each nested class is true?
- In C#, what is the best way to sort a list of objects by a string property and get correct order?
- Sort Class List by specific Variable
- Sort list of PropertyInfos by property value of its attribute
- Linq extension. Change property value in source list
- Removing element from list property in class
- Sort List with two parameters but in different lines of code
- c# Sort a list of objects by a property of an object
- Filter Object List by Property which is a integer list
- How to sort list on multiple properties in one line of code in Linq
- Databinding ListBox to a List of a Class that Contains a navigation Property Of Other Class?
- To add a property value to an existing list of a class
- Based on a list of class objects, how to create a list of valid property names?
- How to sort a list of a custom class by a variable in that custom class? c#
- c# LINQ sort a list by a subproperty of a property that is a list of objects
- How to sort a List with LINQ using Nested Property
- Split list by one property and sort ascending nested list<T> by property
- LINQ select list element based on class property
- Sort entity list based on entity property
- How to sort a list by a specific property in .NET 2.0?
- linq to entity query getting error
- Entity Framework - An item with the same key has already been added. - Error when trying to define foreign key relationship
- LINQ - group specific types of classes
- return type of linq group by multiple column
- Linq GroupBy().Select() with complex type - can't work out syntax
- Can you use Linq to find relationships between elements in a collection?
- Linq Account Hierarchy Drill Down
- Linq query is super slow?
- How to run a function on all members of a list using linq?
- extract word from string with multiple delimeters
- FirstorDefault() causes lazy loading or eager loading for linq to sql
- Resolving method overload among LINQ query methods
- Group list items based on the minimum time difference
- Groupby and where clause in Linq
- C#/LINQ: Trying to optimize performance
- Entity Framework - get records in multiple tables using stored procedure
- Linq - unable to join table due to null value
- Confusion about reading xml file
- Invalid anonymous type member declarator - Anonymous type + Nullable operator
- System.InvalidCastException for DataModel Creation using Sqlite as Database