Imports System
Imports System.Collections.Generic
Public Class ReverseComparer
Implements IComparer(Of String)
Public Function Compare(ByVal x As String,ByVal y As String) As Integer Implements IComparer(Of String).Compare
Return y.CompareTo(x)
End Function
End Class
Public Class Example
Public Shared Sub Main()
Dim numbers() As String = {"A","B","C"}
Dim numbersizes() As Integer = { 4, 5, 3}
Array.Sort(numbers, numbersizes)
For i As Integer = 0 To numbers.Length - 1
Console.WriteLine("{0}: {1}", numbers(i), numbersizes(i))
Next
Dim rc As New ReverseComparer()
Array.Sort(numbers, numbersizes, rc)
For i As Integer = 0 To numbers.Length - 1
Console.WriteLine("{0}: {1}", numbers(i), numbersizes(i))
Next
Array.Sort(numbers, numbersizes, 3, 3)
For i As Integer = 0 To numbers.Length - 1
Console.WriteLine("{0}: {1}", numbers(i), numbersizes(i))
Next
Array.Sort(numbers, numbersizes, 3, 3, rc)
For i As Integer = 0 To numbers.Length - 1
Console.WriteLine("{0}: {1}",numbers(i), numbersizes(i))
Next
End Sub
End Class