Sorting a List based on an ArrayList within a custom Object

Posted by Matt Weldon on Stack Overflow See other posts from Stack Overflow or by Matt Weldon
Published on 2010-05-24T14:27:19Z Indexed on 2010/05/24 14:51 UTC
Read the original article Hit count: 215

Filed under:
|
|

I am using a list to keep track of a number of custom Row objects as follows:

Public Rows As List(Of Row)()

Row has 2 properties, Key (a String) and Cells (an ArrayList).

I need to be able to sort each Row within Rows based on a developer defined index of the Cells ArrayList.

So for example based on the following Rows

Row1.Cells = ("b", "12")
Row2.Cells = ("a", "23")

Rows.Sort(0) would result in Row2 being first in the Rows list. What would be the best way of going about implementing this?

Thanks

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about sorting