I have a List(of String()). I have written a custom comparer (implements IComparer(of string)) to do an alphanumeric sort.
Is there a way to sort the List using a given index to determine which position in the String() to sort by? In other words one time I might sort by Index = 0 and another time by Index = 3. The length of all String() in the list is the same.
For reference this question is similar to Sort List<String[]> except I am using VB.net and that question is hardwired to Index=0.
EDIT from OP's comments:
I started simple with the non custom comparer but I am getting an error: expression does not produce a value. Not sure what I am doing wrong. Here is the code:
Public Shared Function SortListOfStringArray(ByVal ListOfStringArray As List(Of String()), ByVal SortByIndex As Integer) As List(Of String())
Return ListOfStringArray.Sort(Function(x, y) x(SortByIndex).CompareTo(y(SortByIndex)))
End Function