Hainesy - judging by your comment on Vinny's post, I think you're missing his point... [I'm not presenting this as an answer to your question directly, I'm just elaborating on Vinny's point to clear up any possible confusion regarding that.]
Consider this object:
public class Person
{
public string FirstName;
public string MiddleInitial;
public string LastName;
public DateTime DateOfBirth { get; set; }
public int Age
{
get
{
return (int)DateTime.Today.Subtract(DateOfBirth).TotalDays / 365;
}
}
}
now, assume I've got a list of Person set up called People
var people = new List<Person>();
And I've got a whole bunch of people in my list.
var sortedByLastName = people.OrderBy(o => o.LastName);
var sortedByFirstName = people.OrderBy(o => o.FirstName);
var sortedByAge = people.OrderBy(o => o.Age);
var sortedByAgeDesc = people.OrderByDescending(o => o.Age);
var sortedByLastThenFirst = people.OrderBy(o => o.LastName).ThenBy(o => o.FirstName);
That's for complex objects. If we've got a list of some primitive type, like a string:
var strings = new List<string>();
I want to sort them based on themselves - i.e. not by some property of my object
var sorted = strings.OrderBy(s => s);
This will sort on the object. You can also use the same idea if you're sorting complex objects that implement IComparable to sort by their default comparer.
An EntitySet can be sorted in a similar fashion, whether for a primitive type, or a complex object.