Sorting a Generic List By Object Properties
I found this the other day. When you need to quickly sort a generic list by some property, this is MUCH simpler then using Comparers.
List<Person> people = repository.GetAll(); people = people.OrderBy(x => x.LastName).ToList();
or
List<Person> people = repository.GetAll(); people = people.OrderBy(x => x.LastName).ThenBy(x => x.FirstName).ToList();




