Class CustomComparer : Implements IComparer Public Function CompareTo(ByVal o1 As Object, _ ByVal o2 As Object) As Integer _ Implements IComparer.Compare Dim num1, num2 As Integer Try num1 = CType(o1, Integer) num2 = CType(o2, Integer) Catch compareException As system.Exception Throw (compareException) Exit Function End Try If Math.Cos(num1) < Math.Cos(num2) Then Return -1 Else If Math.Cos(num1) > Math.Cos(num2) Then Return 1 Else Return 0 End If End If End Function End Class