What I'm trying to do is iterate over the country collection in retVal and sort each of the <StateProvinces> by Name. The hierarchy is as follows:
retVal[index].StateProvinces.ToList()[index].Name = "";
so that it is country object -> collection of states, each state has a name property and lazy loading it throwing state objects into an order based on the stateID.
What's wrong with this line of code (and why although I'm guessing I'm attempting to abuse the sort method)?
retVal[0].StateProvinces.ToList().Sort(x=>x.Name);
retVal is of type IList<Country>
Error is given for x=>x.Name:
Delegate 'System.Comparison<Country>' does not take 1 arguments
.OrderBy(x=>x.Name);