' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.Collections

Module Main
    Sub Main()
        Dim myarray() as integer = { 1212, 2121, 312 ,32, 1 }
        Dim i As Integer
        Console.WriteLine("Originalt")
        For i = 0 To myarray.Length - 1
            Console.WriteLine(myarray(i))
        Next i
        Array.Sort(myarray)
        Console.WriteLine("Sorteret standard")
        For i = 0 To myarray.Length - 1
            Console.WriteLine(myarray(i))
        Next i
        Array.Sort(myarray, new Reverse())
        Console.WriteLine("Sorteret specielt")
        For i = 0 To myarray.Length - 1
            Console.WriteLine(myarray(i))
        Next i
    End Sub
End Module
Class Reverse
    Implements IComparer
    Function Compare(a As Object, b As Object) As Integer Implements IComparer.Compare
        return (b - a)
    End Function
End Class
