|
Imports System.Runtime.CompilerServices
Public Module IComparableX
''' <summary>converts a Comparison to an IComparer</summary>
Public Function ToComparer(Of T)(ByVal Subj As Comparison(Of T)) As ComparisonComparer(Of T)
Return New ComparisonComparer(Of T)(Subj)
End Function
''' <summary>
''' IComparer-implementierender Wrapper um eine Comparison
''' </summary>
Public Class ComparisonComparer(Of T) : Inherits Comparer(Of T)
Private _Comparison As Comparison(Of T)
Public Sub New(ByVal Comparison As Comparison(Of T))
_Comparison = Comparison
End Sub
Public Overrides Function Compare(ByVal x As T, ByVal y As T) As Integer
Return _Comparison(x, y)
End Function
End Class
End Module
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.