Reputation: 20464
I have a List(of Integer())
and I would like to sort the elements of the integer array, all this in-one-line, the problem is that the Array.Sort
method does not return a value then which would be an efficient way?
So for example my list contains as the first Array element (MyArrayList.First) this Array:
{4, 5, 2, 6, 3, 1}
I need to sort the elements
{1, 2, 3, 4, 5, 6}
Example (not working):
' Combos is the List(of Integer())
Combos = (From Combo As Integer() In Combos
Select Array.Sort(Combo)).ToList
Upvotes: 0
Views: 125
Reputation: 11773
Is this what you are looking for
Combos.ForEach(Sub(x As Integer()) Array.Sort(x))
Upvotes: 2
Reputation: 25013
Why the desire to use just one line?
For Each x In combos : Array.Sort(x) : Next
Upvotes: 1
Reputation: 9981
One line:
Dim result = (From item As Integer() In list Select (From n As Integer In item Select n Order By n Ascending).ToArray()).ToList()
Upvotes: 1