Quantcast
Channel: sorting a list
Viewing all articles
Browse latest Browse all 2

sorting a list

$
0
0
Hi!

You need to convert that Structure into a Class implementing ICompare to create a Custom Sort.

You code should look like this.

Public Class MyParams 
    Implements IComparable 
 
    Public level as Integer 
    other 
 
    Public Function ComparteTo(obj as object) as Integer 
        If (Level = obj.Level) Then 
            Return 0 
        Else 
            If (Level > obj.Level) Then 
                Return 1 
            Else 
                Return -1 
            End If 
         
        End If 
    End Function 
End Class 

Then you List can sort correctly.

I don't test that code but should work.

You can read more here (http://msdn.microsoft.com/en-us/library/234b841s.aspx)

Hope that help you.

Bye!


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images