customcomparer.vb
来自「Mastering VBNet Include Source Code」· VB 代码 · 共 25 行
VB
25 行
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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?