Reputation: 33738
So here's the line that is erring:
@For Each item In futureClasses.OrderBy(
Function(c) c.ClassDates.OrderBy(
Function(d) d.Value).ToList).ToList
The relevant parts of the class structure are:
Public Class [Class]
Public Property ClassDates As List(Of ClassDate) = New List(Of ClassDate)
End Class
Public Class ClassDate
Implements IComparable(Of ClassDate)
Public Property Value As Date
Public Function CompareTo(other As ClassDate) As Integer Implements IComparable(Of ClassDate).CompareTo
Return Me.Value < other.Value
End Function
End Class
The idea is to construct a list of [Class]
objects (to iterate over) that are in order by which one occurs first in the stream of time.
The error I get is:
At least one object must implement IComparable.
I've set a breakpoint on that line. When the error occurs futureClasses
contains 2 [Class]
elements, each with a single ClassDate
.
The values are:
futureClasses(0).ClassDates(0).Value = #3/13/2014#
futureClasses(1).ClassDates(0).Value = #4/17/2014#
Does anyone see why this wee or is being thrown?
Upvotes: 0
Views: 1492
Reputation: 6809
I think what you are looking for is something like this:
futureClasses.OrderBy(Function(c) c.ClassDates.OrderBy(Function(d) d.Value).First().Value).ToList
Upvotes: 2