It appears so, but I can't find any definitive documentation on the subject.
What I'm asking is if the result of this query:
from x
in Db.Items
join y in Db.Sales on x.Id equals y.ItemId
group x by x.Id into g
orderby g.Count() descending
select g.First()
is ALWAYS THE SAME as the following query:
from x
in Db.Items
join y in Db.Sales on x.Id equals y.ItemId
group x by x.Id into g
select g.First()
note that the second query lets Linq decide the ordering of the group, which the first query sets as number sold, from most to least.
My ad-hoc tests seem to indicate that Linq automatically sorts groups this way, while the documentation seems to indicate that the opposite is true--items are returned in the order they appear in the select. I figure if it comes sorted this way, adding the extra sort is pointless and wastes cycles, and would be better left out.