I have a LINQ function to get 3 things :: Line, Average of Duration and Count
I have a problem to sort it based on Average Of Duration column.
Here is my code:
Dim group2 As IEnumerable(Of DataRow) = _
From row In Ds.Tables(0).AsEnumerable() _
Group row By LINENAME = row.Field(Of String)("LINENAME") Into grp = Group _
Order By (LINENAME >= Convert.ToString(LINENAME)) _
Select DTRow(grpTot, _
New Object() {LINENAME, _
New TimeSpan(CType( _
grp.Average(Function(r2 As DataRow) TimeSpan.Parse(r2.Field(Of String)("EVENTTM")).Ticks), _
Int64 _
) _
), _
grp.Count() _
} _
)
How can I sort my LINQ based on the Average, not based on LINENAME like the above code?