This doesn t seem to work as I intend.
VB.NET:
Dim x = Model.Discussions.OrderByDescending(Function(d) d.Messages.OrderByDescending(Function(m) m.Sent).First.Sent)
For Each d As Discussion In x
...
Next
I get this runtime error:
Sequence contains no elements
There should be 20.
Discussions are collections of messages.
I want to sort my discussions by the age of the newest message of each.
Clarification
I need to sort my discussions, not my messages. I want to sort my discussions by an aggregate calculation: MAX(Sent) among the messages of each.