Göran Andersson wrote:
Not sure if that C# code will play in VB. :)
I found this way to be reasonable:
In class Key, add a shared function:
Public Shared Function CompKeysByName( ByVal X As Key, ByVal Y As Key) As Integer
Return X.Name.CompareT o(Y.Name)
End Function
Then for the sort, do
oSection.Keys.S ort(AddressOf Key.CompKeysByN ame)
>
You just have to supply the Sort method with a Comparison:
>
oSection.Keys.S ort(delegate(Ke y x, Key y){ return
string.Compare( x.Name, y.Name); })
You just have to supply the Sort method with a Comparison:
>
oSection.Keys.S ort(delegate(Ke y x, Key y){ return
string.Compare( x.Name, y.Name); })
Not sure if that C# code will play in VB. :)
I found this way to be reasonable:
In class Key, add a shared function:
Public Shared Function CompKeysByName( ByVal X As Key, ByVal Y As Key) As Integer
Return X.Name.CompareT o(Y.Name)
End Function
Then for the sort, do
oSection.Keys.S ort(AddressOf Key.CompKeysByN ame)
Comment