Imports System
Imports System.Collections
Public Class SamplesArray
Public Class myReverserClass
Implements IComparer
Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
Return New CaseInsensitiveComparer().Compare(y, x)
End Function
End Class
Public Shared Sub Main()
Dim myArr As [String]() = {"The", "QUICK", "BROWN", "FOX", "jumps", "over", "the", "lazy", "dog"}
Dim myComparer = New myReverserClass()
' Sorts a section of the Array using the default comparer.
Array.Sort(myArr, 1, 3)
PrintIndexAndValues(myArr)
' Sorts a section of the Array using the reverse case-insensitive comparer.
Array.Sort(myArr, 1, 3, myComparer)
PrintIndexAndValues(myArr)
End Sub
Public Shared Sub PrintIndexAndValues(myArr() As [String])
Dim i As Integer
For i = 0 To myArr.Length - 1
Console.WriteLine(" [{0}] : {1}", i, myArr(i))
Next i
End Sub
End Class