1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Public Class MonComparer
Implements IComparer
Public Function Compare( ByVal x As Object, ByVal y As Object) As Integer _
Implements IComparer.Compare
Dim ligne1 As String = CStr(x)
Dim ligne2 As String = CStr(y)
Dim champs1() As String = ligne1.Split(" ")
If champs1(0) > champs2(0) Then
Return 1
ElseIf champs1(0) < champs2(0)
Return -1
ElseIf champs1(2) > champs2(2) Then
Return 1
ElseIf champs1(2) < champs2(2) Then
Return -1
Else
Return 0
End If
End Function 'IComparer.Compare
End Class
...
Array.Sort(lignes, New MonComparer()) |