SolutionCottage.com
Posted  14 Nov 2008 - 15:51:34

Category: ASP.net


Sort a List of objects on variable

Issue:
Say you have a List of objects of the type "CustomerProfile" that is currently sorted on the variable "ID" but you would want this to be sorted on variable "Name" instead.

Solution:

Here is the sample code:

List<CustomerProfile> returnCustomers = customers.OrderBy(x => x.Name).ToList();








0 comments:








© SolutionCottage 2008-2011 9/26/2017 10:08:38 AM