Are you using VB9? If so, I'd use a lambda expression to create a Comparer(Of Schedule_PayItem)
. Otherwise, write a short class to implement IComparer(Of Schedule_PayItem)
. pass whichever one you've got into List.Sort.
An example for the lambda expression (untested):
m_equipmentList.Sort(Function(p1, p2) p1.ResourceID.CompareTo(p2.ResourceID))
And for the IComparer(Of Schedule_PayItem)
:
Public Class PayItemResourceComparer
Implements IComparer(Of Schedule_PayItem)
Public Function Compare(ByVal p1 As Schedule_PayItem, _
ByVal p2 As Schedule_PayItem) As Integer
Return p1.ResourceID.CompareTo(p2.ResourceID)
End Function
End Class
...
m_equipmentList.Sort(New PayItemResourceComparer)